1 Replies - 9544 Views - Last Post: 10 July 2008 - 05:25 PM Rate Topic: -----

#1 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1055
  • View blog
  • Posts: 4,087
  • Joined: 02-July 08

How do I reference a textbox value on a different form?

Post icon  Posted 10 July 2008 - 02:53 PM

Hi all,
I am using then IIF command and want to reference a textbox value from a different form that is part of my project.

Ami2Mg.Text = CStr(IIf((CDbl(wtbox.Text) * CDbl(Ami2Dos.Text)) < CDbl(Ami2.TextBox1.Text), (CDbl(wtbox.Text) * CDbl(Ami2Dos.Text)), "150"))



Ami2.textbox1 is the textbox on the Ami2 Form.


I get a system.innerException with this format. Stating it referred to itself when building the form?

I am using this form to change values when needed - like a default storage. I know probably not the right way, but until I learn this is what I got...Thanks for the help.

Is This A Good Question/Topic? 0
  • +

Replies To: How do I reference a textbox value on a different form?

#2 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2263
  • View blog
  • Posts: 9,467
  • Joined: 29-May 08

Re: How do I reference a textbox value on a different form?

Posted 10 July 2008 - 05:25 PM

Basic format of referencing Form objects
<Form Name>.<Control Name>.<Value Name>
Example code
MainForm.TheTextBox.Text=OtherForm.OtherTextbox.Text


If the above code is inside MainForm you can use
Me.TheTextbox.Text=OtherForm.OtherTextbox.Text


or
TheTextBox.text=OtherForm.Textbox.text


and if the example is in OtherForm
MainForm.TheTextBox.Text=Me.OtherTextbox.Text


or
MainForm.TheTextBox.Text=OtherTextbox.Text


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1