Qbasicnews.com

Full Version: Inputbox limit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Im writing an app in VB, which requires the user to enter data through inputboxes. But in one section an inputbox is not suitable because of its size limit. Anyone know how I can enter a larger amount of text?

I tried a seperate form with a texbox, but I dont know how to organise it, because It opens up the other form but continues running the routine in the original.

ta
In the main form, when opening the inputbox form of your own:

Code:
myInputBoxForm.Show 1, me

or "true", can remember. But that will make it modal thus locking the original form until focus resumes from the spawned form (when it goes "me.hide"). The "me" part passes the main forms id on as the owner form which will save you many problems with a program not shutting down when you close the main form.
Thats awesome, works just like I needed, thanks.

another Q: How do I pass vars across forms?
Add Property Let/Get routines to the forms (fancy cool new OO way) or put Global variables in a module (crappy old non-OO way).
Well, I have a public variable declared at the beginning of the main module (in general declarations), but it still wont carry that variable across forms. Anything Im doing wrong?
you have to specify what form the variable you wish to access is in. Like this:

In the main form (named frmMain fx):

Code:
public ThisVarIsShared as string

Private Sub ... aso

And then in the form accessing that var:

Code:
sub doStuffWithVar
   frmMain.ThisVarIsShared = "value goes here"
end sub

Same goes the other way round.
You can also use the built-in constants vbModal and vbModeless. The 1 (magic number in the example above) doesn't mean True, it means "modal."
Make sure you're using Option Explicit, too; that'll catch the bug of not using the form name before the Public variable at compile time. Smile
Oh! That makes so much more sense now! Thankies ^.^