First off forgive me because I am totally new to VB.net. I know a little VBA for Access and if I mess up my terminology, bear with me.
What I am trying to do is open form2 from form 1, but in the load event of form2, I want to figure out what button on form1 was pressed to open form2, then load the appropriate code from there.
For example... Form1 has 2 context menu buttons that open the same form (form2). When form2 opens, I want to know if it was button1 or button2 that was clicked to open form2.
I was looking into the sender and e parameters, but I could only figure out the form name of the form that opened it using sender.name
Was thinking something like
But like I said sender.name only returns the name of the previous form that opened this form.
The end result I am trying to get is slightly more complicated, but this method "technically speaking" should work. What I want to do is what would be the equivalent to the "Open in add mode" in MS Access. I figured how to load a dataset and populate fields and be able to navigate through records on open of the form, but for button2 I want to be able to open the form to a blank form, ready to add a new record, WITHOUT navigation buttons.
Even if someone has a better method top open the form in "add mode" please describe the first part in detail just for future reference.
Thank you
What I am trying to do is open form2 from form 1, but in the load event of form2, I want to figure out what button on form1 was pressed to open form2, then load the appropriate code from there.
For example... Form1 has 2 context menu buttons that open the same form (form2). When form2 opens, I want to know if it was button1 or button2 that was clicked to open form2.
I was looking into the sender and e parameters, but I could only figure out the form name of the form that opened it using sender.name
Was thinking something like
Code:
[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]If sender.name = "Name of button1 on form 1" then[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Do this code[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Else[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Do this code[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]End If[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]
The end result I am trying to get is slightly more complicated, but this method "technically speaking" should work. What I want to do is what would be the equivalent to the "Open in add mode" in MS Access. I figured how to load a dataset and populate fields and be able to navigate through records on open of the form, but for button2 I want to be able to open the form to a blank form, ready to add a new record, WITHOUT navigation buttons.
Even if someone has a better method top open the form in "add mode" please describe the first part in detail just for future reference.
Thank you