|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How can I change a property of a control form Form2 ?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" 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 Show quoteHide quote "Ali" <A**@discussions.microsoft.com> schreef in bericht news:F9A3F7E3-1A11-45E6-9710-4DB0EFB04A98@microsoft.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" On Sun, 18 Jun 2006 08:57:19 +0200, "Cor Ligthert [MVP]"
<notmyfirstn***@planet.nl> wrote: Show quoteHide quote >Ali I've seen this answer posted previously. However, I can't see how> >\\\\ >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 > this line could possibly work: WhatINeed = me.owner.Textbox1.Text The line should be: WhatINeed = Me.Owner.Controls("TextBox1").Text Gene
Show quote
Hide quote
"gene kelley" <o***@by.me> schrieb: The line 'Me.Owner.TextBox1.Text' only works with 'Option Strict Off'. If >>\\\\ >>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 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/> 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 Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht news:OAlpKgrkGHA.4508@TK2MSFTNGP05.phx.gbl... > "gene kelley" <o***@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/> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schrieb: I'm sure you know that :-).> dohhhhhhhh > > You believe probably that I know that. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> 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 ..... -- Show quoteHide quoteGrumpy Aero Guy "Ali" <A**@discussions.microsoft.com> wrote in message news:F9A3F7E3-1A11-45E6-9710-4DB0EFB04A98@microsoft.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"
vs for .Net SUCKS Big Time
[STRING] extract a word and text around it Learning Programming Newbie Question VB2005 - Sort DataGridView on Text (FormattedValue) of a ComboBox column instead of underlying value Object reference not set to an instance of an object Timer1_Tick is never fired Application.ExecutablePath not recognisze by studio express 2005 appPath News content into an XML file |
|||||||||||||||||||||||