473,396 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How can I change a property of a control form Form2 ?

Ali
Hello
How can I change a property of a control from From2 but the control is in
Form1.
I wrote these code in Form2 but didnt work.

Dim f as new form1
f.Textbox1.Text = "hello world"
Jun 17 '06 #1
6 1585
Ali

\\\\
Public Class Form1
Sub ShowOtherForm()
Dim frmPrint As New Form2
frmPrint.Owner = Me
frmPrint.Show()
End Sub
///
Now you can use in your second form
\\\
WhatINeed = me.owner.Textbox1.Text
///
I hope this helps,
Cor
"Ali" <Al*@discussions.microsoft.com> schreef in bericht
news:F9**********************************@microsof t.com...
Hello
How can I change a property of a control from From2 but the control is in
Form1.
I wrote these code in Form2 but didnt work.

Dim f as new form1
f.Textbox1.Text = "hello world"

Jun 18 '06 #2
On Sun, 18 Jun 2006 08:57:19 +0200, "Cor Ligthert [MVP]"
<no************@planet.nl> wrote:
Ali

\\\\
Public Class Form1
Sub ShowOtherForm()
Dim frmPrint As New Form2
frmPrint.Owner = Me
frmPrint.Show()
End Sub
///
Now you can use in your second form
\\\
WhatINeed = me.owner.Textbox1.Text
///
I hope this helps,
Cor


I've seen this answer posted previously. However, I can't see how
this line could possibly work:
WhatINeed = me.owner.Textbox1.Text

The line should be:
WhatINeed = Me.Owner.Controls("TextBox1").Text

Gene
Jun 18 '06 #3
"gene kelley" <ok**@by.me> schrieb:
\\\\
Public Class Form1
Sub ShowOtherForm()
Dim frmPrint As New Form2
frmPrint.Owner = Me
frmPrint.Show()
End Sub
///
Now you can use in your second form
\\\
WhatINeed = me.owner.Textbox1.Text
///
I hope this helps,
Cor


I've seen this answer posted previously. However, I can't see how
this line could possibly work:
WhatINeed = me.owner.Textbox1.Text

The line should be:
WhatINeed = Me.Owner.Controls("TextBox1").Text

The line 'Me.Owner.TextBox1.Text' only works with 'Option Strict Off'. If
you have turned this option on, use 'DirectCast(Me.Owner,
Form1).TextBox1.Text'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jun 18 '06 #4
dohhhhhhhh

You believe probably that I know that.

I had changed somebody else (who had this not in it) just quick in that was
even another error from me.

Thanks

Cor

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schreef in bericht
news:OA**************@TK2MSFTNGP05.phx.gbl...
"gene kelley" <ok**@by.me> schrieb:
\\\\
Public Class Form1
Sub ShowOtherForm()
Dim frmPrint As New Form2
frmPrint.Owner = Me
frmPrint.Show()
End Sub
///
Now you can use in your second form
\\\
WhatINeed = me.owner.Textbox1.Text
///
I hope this helps,
Cor


I've seen this answer posted previously. However, I can't see how
this line could possibly work:
WhatINeed = me.owner.Textbox1.Text

The line should be:
WhatINeed = Me.Owner.Controls("TextBox1").Text

The line 'Me.Owner.TextBox1.Text' only works with 'Option Strict Off'. If
you have turned this option on, use 'DirectCast(Me.Owner,
Form1).TextBox1.Text'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jun 18 '06 #5
"Cor Ligthert [MVP]" <no************@planet.nl> schrieb:
dohhhhhhhh

You believe probably that I know that.


I'm sure you know that :-).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Jun 18 '06 #6
I use a factory class for this and store instances of the forms in this
class via properties....

Has worked for me well thus far .....

--
Grumpy Aero Guy

"Ali" <Al*@discussions.microsoft.com> wrote in message
news:F9**********************************@microsof t.com...
Hello
How can I change a property of a control from From2 but the control is in
Form1.
I wrote these code in Form2 but didnt work.

Dim f as new form1
f.Textbox1.Text = "hello world"

Jun 19 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ben Reese | last post by:
Simplified. I have 2 forms running on seperate threads (and message queues) I am having some odd problems with with the form on the second Thread/message queue freezing and/or dyinig, seemingly at...
0
by: ptass | last post by:
I have a main form (Form1) which opens a second form (Form2) when a button is clicked. Form2 has .FormBorderStyle set to FixedSingle. Form2 contains two buttons, one which unpins it from Form1...
1
by: Kun | last post by:
Hi there, I think vs.net missing default name for new form. Scenario: 1. I create new Window Application by default it give me Form1 2. I add Form2 3. In Form1_Load event I try to get form2...
2
by: Lance | last post by:
I want to be able to reset a complex property in a PropertyGrid. I know that for properties that are ValueTypes you can include System.ComponentModel.DefaultValue in the declaration of the property....
5
by: Luis Ramos | last post by:
Hello, How do i change a label in another form from another one? in vb6 i use to do this: form1: private sub label1_change() form2.label1.caption="hgghjghjg" ' and the label in form2 is...
3
by: Mateusz Rajca | last post by:
Hello, I have Form1 - the main form with some controls including a button. I have Form2 - the properties form with a combobox and button. The user can select the colors of a button in the...
1
by: Mahmoud Al-Qudsi | last post by:
To make it easier for translators to convert my program to their local language, I'm using XML files as translation dictionaries since its much easier for deployment and production purposes. ...
1
by: =?Utf-8?B?WmVsamtv?= | last post by:
Hello! I am new in programing and I have this problem: I must on button5_Click move current form. The code of form is: using System; using System.Collections.Generic; using...
9
by: kimiraikkonen | last post by:
Hello experts, That's very very simple question but i wonder if you can help: I have form1 and a button which brings user to form2 when button is clicked, and i have a web-browser (.net 2.0...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.