Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h3>Pointers exist but they're called object references</h3> <p><em>(Now other posters, please don't quibble with me about the actual differences here. I am talking about the high level task the OP wants to accomplish)</em></p> <p>Obviously you can't do literally what you've said - that is, surgically manipulate one member. But if you have control of the code, you can do almost as well. And from what you describe is your problem, this method will be much better, as you can pass references to an object that has many members you wish to update, instead of having to pass many individual pointers.</p> <p>First define a class: </p> <pre><code>Class MyScreenValues ' Properties will work... using public fields for brevity Public TextBox1Value as String Public SpinControl1Value as Integer public CheckBox1Value as Boolean End Class </code></pre> <p>Now the equivalent of the code you posted: </p> <pre><code>Dim x as new MyScreenValues 'int x; dim foo as MyScreenValues = x 'int&amp; foo = x; '// c++: foo is now a reference to x so this sets x to 56 '// .net: foo is now a reference to x so this sets x.SpinControl1Value to 56 foo.SpinControl1Value = 56; </code></pre> <p>If what you're doing is trying to pass pointers to, say, every control on your form's value to a sub, like so:</p> <pre><code>Button1_Click(... Dim MyObject as new BusinessObject MyObject.DoSubmit(TextBox1.Text, SpinButton1.Value, CheckBox1.Checked) </code></pre> <p>You can use the method provided by superbDeveloper, and use the ByRef keyword on the definition of the DoSubmit Sub:</p> <pre><code>Public Sub DoSubmit(ByRef Name as String, ByRef Age as Integer, ByRef Employed as boolean) ... business logic... </code></pre> <p>However this just gives you a 2-layer separation. Look into MVP, MVC, etc - however consider submitting the entire view worth of data. It's a lot of research you you may settle with what you have now. For example your business logic will be firing events on the form as it changes the form values (well, actually, they won't fire until the sub exits, due to the way VB deals with byref properties [=temp variable], but it needs to be considered).</p> <p>You can also map an object's properties to a Form's properties with other libraries. Check out <strong>VALUE INJECTOR</strong> on the web. It can take a webform/winform and maybe even a WPF form and map the control values to and from an object you have predefined. Excellent for complete separation. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload