PC Review


Reply
Thread Tools Rate Thread

Accessing form's text box from Module

 
 
Elmo Watson
Guest
Posts: n/a
 
      7th Jan 2007
I have come from a VB6 background, and I'm trying to convert an MDI app that
has many subs in modules which directly access
a textbox in a child form of the main MDI form (frmMain as MDI form, frmEdit
as child form, txtEdit as richtextbox)
code:
With frmMain.ActiveMdiChild.txtEdit

I totally understand OO concepts now, which I didn't (completely) when the
app was originally written, but I really don't want to re-write every single
sub and make it a function, to output text - that would make me want to
shoot the computer.
I guess, the other option would be to put all this stuff in the MDI form or
MDI child, however, that would really bloat those forms....(IMHO)

Is there a way to reference the textbox on the child form, directly inside a
module, with VB.Net (2005)?


 
Reply With Quote
 
 
 
 
Stephany Young
Guest
Posts: n/a
 
      7th Jan 2007
You mean like?:

Module xyz

Public Sub UpdateRichTextBox()

CType(CType(Application.OpenForms("frmMain"), frmMain).ActiveMdiChild,
frmEdit).txtEdit.Text = "The quick brown fox ..."

End Sub

End Module


"Elmo Watson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have come from a VB6 background, and I'm trying to convert an MDI app
>that has many subs in modules which directly access
> a textbox in a child form of the main MDI form (frmMain as MDI form,
> frmEdit as child form, txtEdit as richtextbox)
> code:
> With frmMain.ActiveMdiChild.txtEdit
>
> I totally understand OO concepts now, which I didn't (completely) when the
> app was originally written, but I really don't want to re-write every
> single sub and make it a function, to output text - that would make me
> want to shoot the computer.
> I guess, the other option would be to put all this stuff in the MDI form
> or MDI child, however, that would really bloat those forms....(IMHO)
>
> Is there a way to reference the textbox on the child form, directly inside
> a module, with VB.Net (2005)?
>



 
Reply With Quote
 
Elmo Watson
Guest
Posts: n/a
 
      7th Jan 2007
Absolutely great! I've been looking for this for so long

I just dimmed that all as a RichTextBox at the head of the Module and
everything went perfectly

Thanks! - You're a life saver

"Stephany Young" <noone@localhost> wrote in message
news:(E-Mail Removed)...
> You mean like?:
>
> Module xyz
>
> Public Sub UpdateRichTextBox()
>
> CType(CType(Application.OpenForms("frmMain"),
> frmMain).ActiveMdiChild, frmEdit).txtEdit.Text = "The quick brown fox ..."
>
> End Sub
>
> End Module
>
>
> "Elmo Watson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>I have come from a VB6 background, and I'm trying to convert an MDI app
>>that has many subs in modules which directly access
>> a textbox in a child form of the main MDI form (frmMain as MDI form,
>> frmEdit as child form, txtEdit as richtextbox)
>> code:
>> With frmMain.ActiveMdiChild.txtEdit
>>
>> I totally understand OO concepts now, which I didn't (completely) when
>> the app was originally written, but I really don't want to re-write every
>> single sub and make it a function, to output text - that would make me
>> want to shoot the computer.
>> I guess, the other option would be to put all this stuff in the MDI form
>> or MDI child, however, that would really bloat those forms....(IMHO)
>>
>> Is there a way to reference the textbox on the child form, directly
>> inside a module, with VB.Net (2005)?
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read text of form/report module code via VBA Dale Fye Microsoft Access VBA Modules 6 23rd Sep 2009 04:29 AM
Accessing a Varibly Named Table value in a Module called from a Form dave b via AccessMonster.com Microsoft Access VBA Modules 3 24th Apr 2006 11:49 PM
Writing to a label.text on form from within a module RD Microsoft VB .NET 5 21st Dec 2004 09:10 AM
Accessing form from module =?Utf-8?B?TXVzdGFmYQ==?= Microsoft Dot NET 1 5th Jul 2004 11:35 AM
Deposit value in Text Box from form code module SQL Query Greg Green Microsoft Access Form Coding 4 4th Sep 2003 06:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:24 PM.