Re: Understanding Public Module or Class



Thanks Kevin and Cor for the great info. I found the information very
interesting and give me a better idea of what to use.

Thanks again!

Rudy

"Cor Ligthert [MVP]" wrote:

Rudy,

These three are almost the same
VB.Net
\\\
Module MyModule
Public myPublic as String
End module
///
Class MyModule
Public shared myPublic as String
End Class
////
The difference is in this that you can use with a module the myPublic
without calling the module (The later is possible as well and much nicer but
this is not a VB.Net newsgroup)

C#
\\\
Class MyModule
{public static string myPublic;}
///

The last two are exact the same.

Although this is an example; in all three I would use properties and private
members instead of the public as it is showed now.

I hope this gives an idea,

Cor

"Rudy" <Rudy@xxxxxxxxxxxxxxxxxxxxxxxxx> schreef in bericht
news:A821B16D-6C38-4F71-BF58-58756293E1AA@xxxxxxxxxxxxxxxx
Hello All!

I'm a little confused on Public Class or Modules.
Say I have a this on form "A"
Public Sub Subtract()
Dim Invoice As Decimal
Dim Wage As Decimal
Static PO As Decimal
Invoice = CDec(txbInv.Text)
Wage = CDec(txbTotWage.Text)
PO = Invoice - Wage
txbPO.Text = PO.ToString.Format(PO)
End Sub
So I know I can call this up anywhere within that form. But now I need to
use this in form "b". The textboxes are in place in form "b", same name
and
everything else. So a couple of things about this. First, will I run into
problems if I have textboxes named the same in two diffrent forms? Would I
use a public Class, or Module. I guess I don't understand the diffrence.
And
I would I call up this in Form "B"?

TIA!!!

Rudy



.



Relevant Pages

  • Re: Understanding Public Module or Class
    ... Public shared myPublic as String ... Dim Invoice As Decimal ... Dim Wage As Decimal ... problems if I have textboxes named the same in two diffrent forms? ...
    (microsoft.public.dotnet.general)
  • Re: Oracle NULL vs revisited
    ... invoice identifier. ... function representung the string less its non-numeric characters. ... substitute for an unknown value. ...
    (comp.databases.oracle.server)
  • Re: jtds driver and SQL Server performance problem
    ... The slow query is retreiving the row based on a "char" column. ... } catch (SQLException e) ... invoice = checkInvoice; ... public void writeInvoice(int docid, int objectid, String invoice) ...
    (comp.lang.java.databases)
  • Re: help please! reading text re post
    ... Dim Buffer As String ... get stuff like invoice date, ... Declare 3 integer variable (e.g. posi As Integer, t As Integer, ...
    (microsoft.public.vb.general.discussion)
  • Re: Form Calculation writes record to Audit Log
    ... Enum enumLogTypes 'Keep in sync with tblLogTypes ... For example, on an invoice, if the user changes the ... Public Function AuditLog(LogType As String, ...
    (comp.databases.ms-access)