|
Of course not. All you did was create a Member object, called it Mem1, set a bunch of properties on it, then forgot about when the Sub finished.
What are you trying to save this object in? You don't have any code in here to save the object anywhere.
You need to store the object somewhere, like in a collection, that was created outside this function you posted. Currently, the Member object you created only exists inside this function.
For instance, if you wanted to create a new TextBox control on a form you could:
Private Sub btnNewTextBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewTextBox.Click
Dim myNewTextBox As New TextBox
myNewTextBox.Text = "Some text..."
End Sub
Just like you did with your Member object. But, you'll never see this TextBox to be able to do anything with it because at the end of the function, the new object is detroyed because nothing outside this function can get to it. What you need to do is add it to a collection that was created outside this function. In my example, its the form's Controls collection:
Private Sub btnNewTextBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewTextBox.Click
Dim myNewTextBox As New TextBox
myNewTextBox.Text = "Some text..."
Me.Controls.Add(myNewTextBox)
End Sub
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
how would i do this if i am to create more members from the same control??? i'm new to this.
|
|
|
|
|
Same thing. Create the new member and add it to a collection that's been created outside the function your creating the new member in.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
|
Details man! Details! What on earth are you talking about, "other end"? Of what, a 10 foot pole?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
;PR u joking it means from other form
|
|
|
|
|
|
Keep going! That's helpful, but only a little bit.
I'll make a bunch of assumptions here and just drop a little tidbit for you. A form can NEVER close the form that created it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Your lack of detail is the joke here. So far, what you've done is walk up to a street corner and ask a total stranger, "How do I close my door from here?". Of course, he/she is going to ask you "What door?", "What kind of door?", "A car door, door on your house, what?", "Where is the door you want to close?", ...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Your second form needs a reference to the first form. When you have a reference to the Form object, you can call any of the Form's methods, such as Close.
I usually pass a Form reference to another Form object by exposing a property such as ParentForm, or sometimes I pass it via the Forms constructor. A lot depends on circumstances and how I want to use the second Form object.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
I want to start a new application in using vb.net 2.0 and I would like to be able to deploy this application with it's own integrated database. Could someone point me in a direction on how to do this.
Thanks
H.Wolfe
|
|
|
|
|
What do you mean by "integrated"? You can use any database for this, be it SQL Express, MSDE, Access, XML files...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I know what you are saying, i am doing the same thing. The best thing to use is MSDE. it is microsofts smaller free version of SQL. It has a 2GB limit but that is ideal for database apps unless it is something really big.
|
|
|
|
|
Hi to all! I am doing a project of AutoDialer. I have done coding in VB6. Its is ringing the phone. But what I want is, When the reciever picks up the phone, an audio message must be played. The audio message must be prerecorded. Can any body help please, I am using AT comands for ringing the phone.
|
|
|
|
|
This is only possible if you have a Telephony-capable modem. You can't use a normal modem to do this.
Beyond that, you'll have to search for examples of VB6 TAPI applications[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How do I run a SQL stored procedure from within Visual Basic?
Thank you.
|
|
|
|
|
|
the very simple method is use the procedure as you use the select query
cmd.CommandType = "ProcedureName p1,p2,p3"
' Either
cmd.executenonquery
'or if you want to recieve some thing
da.SelectCommand = cmd
da.Fill(Dt)
where cmd= Command
da= dataadapter
dt=datatable
p1,p2,p3 are the parameters which you need to send
hope this will help
|
|
|
|
|
|
hi i am a student working on my final year project i hav dissabled print option from the file menu using a com addin but when i press ctrl + P the print option comes up again. some one help me
and i want only my addin to work in word i want to dissable all other addins can some one guide me
chandrashekar
|
|
|
|
|
Maybe Dave can double check me but if you assign the key sequence to something else like form1.focus then it might bypass the print function.
1. Out of clutter, find simplicity.
2. From discord, find harmony.
3. In the middle of difficulty lies opportunity.
Albert Einstein
three rules of work
|
|
|
|
|
Sorry, I don't do Office automation.
But, it doesn't sound like the right idea.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello, is there anyone know how to auto-fill a textbox?
I have 4 textbox, first_name, middle_name, last_name, and full_name, I want the full_name textbox to be auto-filled when the first_name, middle_name, and last_name entered, so user doesn't need to fill in the full_name textbox. any idea to do this?
thanks.
Lisa
|
|
|
|
|
Handle the TextChanged events of the 3 text boxes, you could even do this with a single function. Combine the contents of the 3 text boxes and place the result in the FullName textbox.
Private Sub NameTextBoxesChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FirstName.TextChanged, MiddleName.TextChanged, LastName.TextChanged
FullName.Text = LastName.Text & ", " & FirstName.Text & " " & MiddleName.Text
End Sub
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|