954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Form in SplitContainer

I have a problem on passing value from Main Form to 2nd Form. Actually, I have a 2nd Form on the SplitContainer and the SplitContainer is placed inside the Main form.

What I want to do is Click the Button on the 2nd Form from the Main Form.


Thanks in advance.

thwias1b3008
Newbie Poster
8 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 

First, may I ask why you would want to do this? Wouldn't it just be easier to put the button on the form you were using? Anyways, I will try to help.

You could try something like this. On Form2 add the Following Sub:

Public Sub Command2_Click()
        'Your Code Here
    End Sub


Now on Form1 we need to create this Public Sub:

Public Sub Command1_click()
        Form2.Command2_Click()
    End Sub


Now on Form1's button we need to add the following code:

Command1_Click()


This will make the button on Form1 access the code on Form2. Also you can add the following code to the button on Form2 so that button will carry out the same code as the sub:

Command2_Click()

This isn't exactly what you asked for but this is close. If not, then this will get you started.

NetJunkie
Junior Poster
158 posts since Aug 2011
Reputation Points: 41
Solved Threads: 28
 

I think your code is for VB6 and not on VB.net.

Anyway, thanks for your help.

thwias1b3008
Newbie Poster
8 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 

I think your code is for VB6 and not on VB.net.

Anyway, thanks for your help.


No, this is in Visual Basic 2010 Express.

NetJunkie
Junior Poster
158 posts since Aug 2011
Reputation Points: 41
Solved Threads: 28
 

Really, but I also use Visual Basic 2010. and it didn't work.

thwias1b3008
Newbie Poster
8 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 

Make sure you are making it a Public Sub otherwise it will not work. Also, if you would like you can send me the errors you are receiving so I can troubleshoot it with you.

NetJunkie
Junior Poster
158 posts since Aug 2011
Reputation Points: 41
Solved Threads: 28
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: