|
-
Aug 21st, 2002, 08:50 PM
#1
Thread Starter
Fanatic Member
Open a Form
I am trying to make the move from vb6 to vb.net. How do you call a form that you have in your project. This is the the I want to do. I have two forms, when someone clicks on a text box in one form I want to populate another form with some strings and display it. For the life of me I can't see how to do this.
Thanks.
-
Aug 21st, 2002, 09:02 PM
#2
If you want to make it mandatory that info gets passed in order to display the form then you can add the data as parameters to the New() method of the form and add your code to the bottom of it. Otherwise you can make override the New() method with the parameters so you can use either or. If you override the Constructor (New) then make sure and call the original one first either with:
New()
'or
MyBase.New()
-
Aug 21st, 2002, 09:04 PM
#3
Thread Starter
Fanatic Member
You the man Ed, could you post a little example code?
-
Aug 21st, 2002, 10:42 PM
#4
New Member
Try this
coding in button:
Dim frm1 As form
frm1=new formA(b)
frm1.show
coding in form you want to call:
(Click the "Windows Form Designer generated code" first)
Dim test As string
Public sub new(ByVal a As String)
MyBase.New()
test=a
"b" is a value you want to send to the form you call.
"a" receive value "b".
-
Aug 21st, 2002, 11:43 PM
#5
Thread Starter
Fanatic Member
SO this part:
coding in button:
Dim frm1 As form
frm1=new formA(b)
frm1.show
Goes into the form where I am trying to call the form?
And this part:
(Click the "Windows Form Designer generated code" first)
Dim test As string
Public sub new(ByVal a As String)
MyBase.New()
test=a
Goes into the form I am trying to call? If so where?
-
Aug 22nd, 2002, 02:07 AM
#6
New Member
try again
Double-click the form u want to call, u can see coding.
You can find the coding (almost) like this :
Public Class formA
inherits System.Windows.Forms.Form
+ Windows Form Designer generated code
After click + at " + Windows Form Designer generated code "
you can see this coding:
Public sub new()
MyBase.New()
try to change to :
Dim test As string
Public sub new(ByVal a As String)
MyBase.New()
test=a
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|