Pasing a string to a textbox
Hello All,
I have a small issue with passing a string to a textbox.. the senario is as follow:Form1 is opened with textbox1 and button1
When pressing button1, form2 opens to allow searching in a database.
Results of form2 search are listed in listview1.
selecting the required reslt is by clicking the desired item in listview1.
Now.. I need to pass the result to textbox1 in form1 that is already opened.
How?
[447 byte] By [
Fayed] at [2007-12-16]
Hi,
In your form1, you could create a method to set the text in your textbox:
Public Sub setText(newText as String)
text1.Text = newText
End SubJust call this function in the event of you listbox this way.
'Inside the click event of listview
Dim myForm As Form1 = DirectCast(Me.Owner, Form1)
myForm.setText(listview.Text <Or whatever the result is>)
' end snippet
BTW, in showing your form2, you must ust the form2.Show(this) method so that the owner would be set to form1...
cheers,
Paul June A. Domag
Paul,
Thank you it worked with a tiny modificartion. I had to declare form2 as owned by form1 while opening form2
Dim fv as New Form2
fv.Owner=me
fv.show()
Thanks again