Click here to Skip to main content
16,005,080 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Communicate with Digitizer Pin
Dave Kreskowiak6-Aug-04 8:09
mveDave Kreskowiak6-Aug-04 8:09 
GeneralWeb Service Help Pin
inetmaster6-Aug-04 5:48
inetmaster6-Aug-04 5:48 
GeneralRe: Web Service Help Pin
Dave Kreskowiak6-Aug-04 7:16
mveDave Kreskowiak6-Aug-04 7:16 
GeneralVBtab not working in a label in VB.NET Pin
dotnetfriend6-Aug-04 5:46
dotnetfriend6-Aug-04 5:46 
GeneralRe: VBtab not working in a label in VB.NET Pin
Dave Kreskowiak6-Aug-04 7:03
mveDave Kreskowiak6-Aug-04 7:03 
GeneralByReference help Pin
Anonymous6-Aug-04 4:20
Anonymous6-Aug-04 4:20 
GeneralRe: ByReference help Pin
Dave Kreskowiak6-Aug-04 5:39
mveDave Kreskowiak6-Aug-04 5:39 
GeneralRe: ByReference help Pin
Anonymous6-Aug-04 6:03
Anonymous6-Aug-04 6:03 
No, I really would like the parameter passed into the constructor to be passed by reference. I tried to make the example simple, but some background might be required to see why I wish to do it this way. Basically, the class is a dialog box, and I want to construct it, binding some of its values to some variables, then show the dialog, and have the variables that are bound be updated automatically, without the calling class having to pull each one out individually.

At first I thought maybe I needed to assign a value to the original integer, as you suggested, but the following still yields a 1, not a 5, which obviously isnt the desired result. So is there a way to set a member variable within a class to a reference to a variable that has been passed in via the constructor?

<br />
Class theClass    <br />
  Private a As Integer    <br />
  Public Sub New( ByRef inA As Integer )<br />
        a = inA    <br />
  End Sub    <br />
<br />
  Public Sub doSomething()<br />
        a = 5   <br />
  End Sub<br />
<br />
End Class<br />


<br />
Dim i as Integer = 1<br />
Dim b As New theClass( i )         ' Passed to the contructor as reference<br />
b.ShowDialog()                     ' User modifies value...should be 5 now...<br />
Debug.WriteLine( i.ToString() )    ' Expect to see 5, instead see 1.  <br />


So, I understand using ByRef in a method, but am really looking to bind the class member to a variable reference, if that is possible. From what I'm seeing here, I'm not sure it is...

Thanks for your help...
GeneralRe: ByReference help Pin
Dave Kreskowiak6-Aug-04 6:40
mveDave Kreskowiak6-Aug-04 6:40 
GeneralRe: ByReference help Pin
Dave Kreskowiak6-Aug-04 6:52
mveDave Kreskowiak6-Aug-04 6:52 
GeneralRe: ByReference help Pin
Anonymous6-Aug-04 7:29
Anonymous6-Aug-04 7:29 
GeneralRe: ByReference help Pin
Dave Kreskowiak6-Aug-04 8:02
mveDave Kreskowiak6-Aug-04 8:02 
GeneralRe: ByReference help Pin
normanordas10-Aug-04 21:49
normanordas10-Aug-04 21:49 
GeneralNeed more helps at datagrid button column Pin
Lisana6-Aug-04 4:15
Lisana6-Aug-04 4:15 
GeneralGood book on Win32 API calls Pin
Simon Kearn6-Aug-04 1:07
sussSimon Kearn6-Aug-04 1:07 
GeneralRe: Good book on Win32 API calls Pin
Michael P Butler6-Aug-04 1:43
Michael P Butler6-Aug-04 1:43 
GeneralRe: Good book on Win32 API calls Pin
Duncan Edwards Jones6-Aug-04 2:11
professionalDuncan Edwards Jones6-Aug-04 2:11 
GeneralRe: Good book on Win32 API calls Pin
Nick Seng8-Aug-04 16:17
Nick Seng8-Aug-04 16:17 
GeneralMouse Enter, Mouse Leave Pin
RWWB6-Aug-04 0:48
RWWB6-Aug-04 0:48 
GeneralRe: Mouse Enter, Mouse Leave Pin
Jim Matthews6-Aug-04 2:52
Jim Matthews6-Aug-04 2:52 
Generaluse c++ dll in VB6 application Pin
sumiko6-Aug-04 0:10
sumiko6-Aug-04 0:10 
GeneralRe: use c++ dll in VB6 application Pin
Michael P Butler6-Aug-04 1:01
Michael P Butler6-Aug-04 1:01 
GeneralRe: use c++ dll in VB6 application Pin
Dave Kreskowiak6-Aug-04 3:04
mveDave Kreskowiak6-Aug-04 3:04 
Generalcommunication with I2C Adapter Pin
sumiko5-Aug-04 21:11
sumiko5-Aug-04 21:11 
GeneralRe: communication with I2C Adapter Pin
Dave Kreskowiak6-Aug-04 3:00
mveDave Kreskowiak6-Aug-04 3:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.