starcraft Posted July 1, 2003 Posted July 1, 2003 Can VB enter text into a textbox on another window? if not can it run a different program that is either built in or in the same folder to enter info into the textbox? :confused: Quote
Mehyar Posted July 1, 2003 Posted July 1, 2003 Declare your form as public inside a module and set its controls from any other form. Quote Dream as if you'll live forever, live as if you'll die today
Leaders dynamic_sysop Posted July 1, 2003 Leaders Posted July 1, 2003 if you have a textbox on Form1 and you want to change it's text from Form2 , you can do this : at top of Form2 , modify the Public Sub New() Public Class Form2 Inherits System.Windows.Forms.Form Public frm As Form1 '/// first make a public reference to your form ( eg: Form1 ) #Region " Windows Form Designer generated code " Public Sub New(ByVal myForm As Form) '/// make myForm as a Form ( not Form1 ) MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() frm = myForm '/// initialize the instance of the form as Form1. 'Add any initialization after the InitializeComponent() call End Sub from a command button on Form2 : Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click frm.TextBox1.Text = "i am some text from form2 to form1's textbox!" End Sub to show the Form2 , do this in Form1 : Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim frmTwo As New Form2(Me) frmTwo.Show() End Sub Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.