[Gambas-user] How do I pass a user parameter from a dialog form?

Roki n.rogozarski at ...626...
Tue Nov 18 21:23:35 CET 2014


try this:
1) in main form

Property Login As String

Private strLogin AS String

Private Function Login_Read()

       Return strLogin

End

Private Sub Login_Write(Value as String) as String

        strLogin = Value

End

Private sub Button1_Click()
	dim f as new frmDialog <-- Your name of dialog form
	if f.ShowModal() Then return
	TextBox1.Text = strLogin

End

2) On DialogForm
    when you click on OK button
    Private Sub btnOK_Click()
    FMain.Login = TextBox1.Text < ---I guess  this is the name of TextBox on your dialog form
    End

And 3) I'm sorry for my bad English, and
I  guess this  will help!
	

On 18.11.2014 20:42, Martin McGlensey wrote:
> Hello,
>
>   
>
> I have created a dialog form. As created by Gambas, it has an OK and Cancel
> button. I want to return three properties or an array from the form. One
> each for the three textboxes on the form.
>
> I added a textbox to the form to test it. Call it Textbox1. Used the code
> below to add a property called "Login" to the Dialog:
>
>   
>
> Property Login As String
>
> Private strLogin AS String
>
>   
>
> Private Function Login_Read()
>
>                  Return txtTextbox1.Text
>
> Return
>
>   
>
> Private Sub Login_Write(Value as String) as String
>
>                  strLogin = Value
>
> End
>
>   
>
> I call the Dialog from the main form by frmDialog.ShowModal. When I load the
> frmDialog, enter the text in the textbox and click OK. The Dialog closes but
> no value is returned to the main form.
>
> If I explicitly set Login_Read to Return "XYZ" it works  properly. It
> returns "XYZ" to the main form. If I try to get the contents of
> Textbox1.Text it returns an empty string. There has got to be a way of
> returning the value of a textbox as a property of a dialog form.  I'd rather
> not use public variables on the main form as there are too many variables
> already.
>
>   
>
> Would you guys please point me in the right direction.
>
>   
>
> Thanks,
>
> Marty
>
>   
>
>   
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user





More information about the User mailing list