Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

does any one know how to save from components declared in functions or sub routine in my case its a richtext which is declared in the function and only know to that function and placed in to document manager which i got from divil.co.uk/net

 

heres the syntax i used to declare it

 

 

Private Sub newdoc()

Dim rtbText As New RichTextBox

rtbText.BorderStyle = BorderStyle.None

rtbText.ScrollBars = RichTextBoxScrollBars.Vertical

rtbText.WordWrap = True

 

rtbText.Multiline = True

rtbtext.ScrollBars = ScrollBars.Vertical

 

Dim doc As New Document(rtb, "New Document")

docMain.AddDocument(doc)

 

 

End Sub

 

i want to know how to save from that but it is only known locally to the sub newdoc()

i also would like to to know how to change the fonts and in the box but but i ill work that out once i find out how to access the richtext box from out side the sub

 

if anyone can help i'll be chuffed

Posted

I would either rdeclare the rtbText as Public or have a Public object and assign rtbText to it once you have created it.

 

There probably is a better way but it's 7:34am, I just got up so my brain is still asleep:)

My website
  • *Experts*
Posted
You could declare it without an instance where all subs and functions can access it and then in the newdoc sub just create an instance from that variable, it will accessible to all subs and functions in the class.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...