• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

Switching between forms

Hi, learning VB 2005

Question:
In my app, I have 2 forms.

On form A, I want to click a button that directs the user to form B.


But I want to populate Form B with values entered into Form A.

How can I do that?


I tried something like this in the code for Form A


private buttonClick()

FormB.TextBox1 = FormA.TextBox1


But it doesn't recognize FormB

Thanks
0
bdb12
Asked:
bdb12
  • 3
  • 3
2 Solutions
 
MrRobotCommented:
try to assign the value while the form is initialized (eg it's already displayed, like after formb.show)
0
 
MrRobotCommented:
ah vb2005

put a public function into formB, like

public sub ShowData(myData)

and display your data in that function. call the function from formA, feeding it with the data you want to be displayed.
0
 
MrRobotCommented:
actually,

public sub ShowData(myData as string)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Mike TomlinsonMiddle School Assistant TeacherCommented:
With VB.Net 2005, you should be able to just use the Forms name.  This is known as the "default instance" of the form.

If it doesn't recognize "FormB" then either...

(1) You have the name wrong.  Is it Form1 and Form2, as opposed to FormA and FormB?

(2) You have disabled the Application Framework in the Project Properties?

0
 
bdb12Author Commented:
hmmmmmm....

in VB.NET you can just do response.redirect....is there a similar way in VB 2005?
0
 
bdb12Author Commented:
form names are pk and app framework enabled
0
 
bdb12Author Commented:
working now thx
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now