"Simon Abolnar" <Simon.Abolnar@ tscng.net> schrieb[color=blue]
>I would like to know how to open child form from dialog form.
>
> Thanks for help!
>
> Simon[/color]
Is the child form to be a child of the dialog form or of another form?
"Armin Zingler" <az.nospam@free net.de> wrote in message
news:%23uuZ5hlW FHA.3716@TK2MSF TNGP12.phx.gbl. ..[color=blue]
> "Simon Abolnar" <Simon.Abolnar@ tscng.net> schrieb[color=green]
>>I would like to know how to open child form from dialog form.
>>
>> Thanks for help!
>>
>> Simon[/color]
>
> Is the child form to be a child of the dialog form or of another form?
>
> Armin[/color]
"Simon Abolnar" <Simon.Abolnar@ tscng.net> schrieb[color=blue][color=green][color=darkred]
>>>I would like to know how to open child form from dialog form.
>>>[/color]
>>
>> Is the child form to be a child of the dialog form or of another
>> form?[/color]
>
> Child form is meant that is child of MDI form.[/color]
Does the dialog form know the MDI form or is it a multi-purpose form that
can be used from different places? That's a question of abstraction. What
does the dialog form do? Will it be closed after the child Form has been
opened? Which results can it pass back to the caller?
My dialog form is login form. When application start,
dialog is open through ShowDialog.
If login is successful, I would like to close my dialog form and open other
child form of MDI.
Thanks for help!
Simon
"Armin Zingler" <az.nospam@free net.de> wrote in message
news:evyJ9OqWFH A.3280@TK2MSFTN GP09.phx.gbl...[color=blue]
> "Simon Abolnar" <Simon.Abolnar@ tscng.net> schrieb[color=green][color=darkred]
>>>>I would like to know how to open child form from dialog form.
>>>>
>>>
>>> Is the child form to be a child of the dialog form or of another
>>> form?[/color]
>>
>> Child form is meant that is child of MDI form.[/color]
>
>
> Does the dialog form know the MDI form or is it a multi-purpose form that
> can be used from different places? That's a question of abstraction. What
> does the dialog form do? Will it be closed after the child Form has been
> opened? Which results can it pass back to the caller?
>
> Armin[/color]
"Simon Abolnar" <Simon.Abolnar@ tscng.net> schrieb[color=blue][color=green][color=darkred]
>>>>>I would like to know how to open child form from dialog form.
>>>>>
>>>>
>>>> Is the child form to be a child of the dialog form or of
>>>> another form?
>>>
>>> Child form is meant that is child of MDI form.[/color]
>>
>>
>> Does the dialog form know the MDI form or is it a multi-purpose form
>> that can be used from different places? That's a question of
>> abstraction. What does the dialog form do? Will it be closed after
>> the child Form has been opened? Which results can it pass back to
>> the caller?[/color]
>
> My dialog form is login form. When application start,
> dialog is open through ShowDialog.[/color]
Is the login form the startup object of the project?
[color=blue]
> If login is successful, I would like to close my dialog form and open
> other child form of MDI.[/color]
This sounds like the MDI form is the startup form.
MDI form is startup form.
In Load event I show dialog (login) form.
Thanks for help!
Simon
"Armin Zingler" <az.nospam@free net.de> wrote in message
news:%23evAUErW FHA.3620@TK2MSF TNGP09.phx.gbl. ..[color=blue]
> "Simon Abolnar" <Simon.Abolnar@ tscng.net> schrieb[color=green][color=darkred]
>>>>>>I would like to know how to open child form from dialog form.
>>>>>>
>>>>>
>>>>> Is the child form to be a child of the dialog form or of
>>>>> another form?
>>>>
>>>> Child form is meant that is child of MDI form.
>>>
>>>
>>> Does the dialog form know the MDI form or is it a multi-purpose form
>>> that can be used from different places? That's a question of
>>> abstraction. What does the dialog form do? Will it be closed after
>>> the child Form has been opened? Which results can it pass back to
>>> the caller?[/color]
>>
>> My dialog form is login form. When application start,
>> dialog is open through ShowDialog.[/color]
>
> Is the login form the startup object of the project?
>[color=green]
>> If login is successful, I would like to close my dialog form and open
>> other child form of MDI.[/color]
>
> This sounds like the MDI form is the startup form.
>
> Which one is true?
>
> I ask to find the best solution.
>
> Armin[/color]
"Simon Abolnar" <Simon.Abolnar@ tscng.net> schrieb[color=blue][color=green][color=darkred]
>>>> Does the dialog form know the MDI form or is it a multi-purpose
>>>> form that can be used from different places? That's a question
>>>> of abstraction. What does the dialog form do? Will it be closed
>>>> after the child Form has been opened? Which results can it pass
>>>> back to the caller?
>>>
>>> My dialog form is login form. When application start,
>>> dialog is open through ShowDialog.[/color]
>>
>> Is the login form the startup object of the project?
>>[color=darkred]
>>> If login is successful, I would like to close my dialog form and
>>> open other child form of MDI.[/color]
>>
>> This sounds like the MDI form is the startup form.
>>
>> Which one is true?
>>
>> I ask to find the best solution.[/color]
>
> MDI form is startup form.
> In Load event I show dialog (login) form.[/color]
IMO this is not good design. I guess the login form also has a cancel button
and if it's pushed, the program exits, right? But then it's too late because
the MDI form is about to be shown. I'd changed it this way:
shared sub main
dim loginform as new loginform
if loginform.showd ialog = dialogresult.ok then
application.run (new mdiform)
end if
end sub
Despite, I still don't know why you want to open an MDI child form from the
login form. Is the child form always to be displayed at startup or does it
depend on any selection within the login form?
1. Thank you very much for your suggestion.
I tried to aplied your solution.
It works OK, except I can't close login dialog.
When I press OK button, application (MDI form) run, with dialog form still
present.
I don't know where to close dialog form. in sub main or in btnOK event and
how?
If loginform.ShowD ialog = loginform.Dialo gResult.OK Then
Application.Run (New frmReferatNET)
End If
End Sub
2. Despite, I still don't know why you want to open an MDI child form from
the
login form. Is the child form always to be displayed at startup or does
it
depend on any selection within the login form?
Yes, I would like to display MDI child form after successfull login. It
depends on user.
Thanks for help!
Simon
"Armin Zingler" <az.nospam@free net.de> wrote in message
news:u7eBklrWFH A.1152@tk2msftn gp13.phx.gbl...[color=blue]
> "Simon Abolnar" <Simon.Abolnar@ tscng.net> schrieb[color=green][color=darkred]
>>>>> Does the dialog form know the MDI form or is it a multi-purpose
>>>>> form that can be used from different places? That's a question
>>>>> of abstraction. What does the dialog form do? Will it be closed
>>>>> after the child Form has been opened? Which results can it pass
>>>>> back to the caller?
>>>>
>>>> My dialog form is login form. When application start,
>>>> dialog is open through ShowDialog.
>>>
>>> Is the login form the startup object of the project?
>>>
>>>> If login is successful, I would like to close my dialog form and
>>>> open other child form of MDI.
>>>
>>> This sounds like the MDI form is the startup form.
>>>
>>> Which one is true?
>>>
>>> I ask to find the best solution.[/color]
>>
>> MDI form is startup form.
>> In Load event I show dialog (login) form.[/color]
>
> IMO this is not good design. I guess the login form also has a cancel
> button and if it's pushed, the program exits, right? But then it's too
> late because the MDI form is about to be shown. I'd changed it this way:
>
> shared sub main
>
> dim loginform as new loginform
>
> if loginform.showd ialog = dialogresult.ok then
> application.run (new mdiform)
> end if
>
> end sub
>
> Despite, I still don't know why you want to open an MDI child form from
> the login form. Is the child form always to be displayed at startup or
> does it depend on any selection within the login form?
>
>
> Armin[/color]
"Simon Abolnar" <Simon.Abolnar@ tscng.net> schrieb[color=blue]
> 1. Thank you very much for your suggestion.
> I tried to aplied your solution.
> It works OK, except I can't close login dialog.
> When I press OK button, application (MDI form) run, with dialog form
> still present.
> I don't know where to close dialog form. in sub main or in btnOK
> event and how?
>
> I changed your solution to:
>
> Shared Sub main()
> Dim loginform As New frmPrijava
>
> loginform.btnOK .DialogResult = loginform.Dialo gResult.OK
>
> If loginform.ShowD ialog = loginform.Dialo gResult.OK Then
>
> Application.Run (New frmReferatNET)
>
> End If
>
> End Sub[/color]
The code looks ok. I can not reproduce the problem. When I click the button,
the loginform disappears and the MDI form is shown. Setting the button's
dialogresult property should be sufficient to close the modal form when the
button is clicked. From here I can't see what causes this behavior. Try to
call Me.Close explicitly in the button's click event.
[color=blue]
> 2. Despite, I still don't know why you want to open an MDI child
> form from the
> login form. Is the child form always to be displayed at startup
> or does it
> depend on any selection within the login form?
>
> Yes, I would like to display MDI child form after successfull login.
> It depends on user.[/color]
There are some design questions involved. The solution I'd probably choose
is this one:
Public Class App
Private Shared f_Username As String
Public Shared ReadOnly Property Username() As String
Get
Return f_Username
End Get
End Property
Shared Sub main()
Dim LoginForm As New LoginForm
If LoginForm.ShowD ialog = DialogResult.OK Then
f_Username = LoginForm.txtUs ername.Text
LoginForm.Dispo se()
LoginForm = Nothing
Application.Run (New MDIForm)
End If
End Sub
End Class
I've set the button's dialogresult property in the designer.
MDIForm:
Private Sub MDIForm_Load( _
ByVal sender As System.Object, ByVal e As System.EventArg s) _
Handles MyBase.Load
Select Case App.Username
'.... open child
End Select
"Armin Zingler" <az.nospam@free net.de> wrote in message
news:u8oRcJtWFH A.2128@TK2MSFTN GP15.phx.gbl...[color=blue]
> "Simon Abolnar" <Simon.Abolnar@ tscng.net> schrieb[color=green]
>> 1. Thank you very much for your suggestion.
>> I tried to aplied your solution.
>> It works OK, except I can't close login dialog.
>> When I press OK button, application (MDI form) run, with dialog form
>> still present.
>> I don't know where to close dialog form. in sub main or in btnOK
>> event and how?
>>
>> I changed your solution to:
>>
>> Shared Sub main()
>> Dim loginform As New frmPrijava
>>
>> loginform.btnOK .DialogResult = loginform.Dialo gResult.OK
>>
>> If loginform.ShowD ialog = loginform.Dialo gResult.OK Then
>>
>> Application.Run (New frmReferatNET)
>>
>> End If
>>
>> End Sub[/color]
>
>
> The code looks ok. I can not reproduce the problem. When I click the
> button,
> the loginform disappears and the MDI form is shown. Setting the button's
> dialogresult property should be sufficient to close the modal form when
> the
> button is clicked. From here I can't see what causes this behavior. Try to
> call Me.Close explicitly in the button's click event.
>[color=green]
>> 2. Despite, I still don't know why you want to open an MDI child
>> form from the
>> login form. Is the child form always to be displayed at startup
>> or does it
>> depend on any selection within the login form?
>>
>> Yes, I would like to display MDI child form after successfull login.
>> It depends on user.[/color]
>
>
> There are some design questions involved. The solution I'd probably choose
> is this one:
>
> Public Class App
>
> Private Shared f_Username As String
>
> Public Shared ReadOnly Property Username() As String
> Get
> Return f_Username
> End Get
> End Property
>
> Shared Sub main()
>
> Dim LoginForm As New LoginForm
>
> If LoginForm.ShowD ialog = DialogResult.OK Then
> f_Username = LoginForm.txtUs ername.Text
> LoginForm.Dispo se()
> LoginForm = Nothing
>
> Application.Run (New MDIForm)
> End If
>
> End Sub
>
> End Class
>
>
> I've set the button's dialogresult property in the designer.
>
>
>
> MDIForm:
>
> Private Sub MDIForm_Load( _
> ByVal sender As System.Object, ByVal e As System.EventArg s) _
> Handles MyBase.Load
>
> Select Case App.Username
> '.... open child
> End Select
>
> End Sub
>
>
> Armin
>[/color]
Well. I still have one little problem.
If user press OK button, but username or password is invalid, how can I
found out that login failed in sub main?
Thanks for your time!
Simon
"Armin Zingler" <az.nospam@free net.de> wrote in message
news:u8oRcJtWFH A.2128@TK2MSFTN GP15.phx.gbl...[color=blue]
> "Simon Abolnar" <Simon.Abolnar@ tscng.net> schrieb[color=green]
>> 1. Thank you very much for your suggestion.
>> I tried to aplied your solution.
>> It works OK, except I can't close login dialog.
>> When I press OK button, application (MDI form) run, with dialog form
>> still present.
>> I don't know where to close dialog form. in sub main or in btnOK
>> event and how?
>>
>> I changed your solution to:
>>
>> Shared Sub main()
>> Dim loginform As New frmPrijava
>>
>> loginform.btnOK .DialogResult = loginform.Dialo gResult.OK
>>
>> If loginform.ShowD ialog = loginform.Dialo gResult.OK Then
>>
>> Application.Run (New frmReferatNET)
>>
>> End If
>>
>> End Sub[/color]
>
>
> The code looks ok. I can not reproduce the problem. When I click the
> button,
> the loginform disappears and the MDI form is shown. Setting the button's
> dialogresult property should be sufficient to close the modal form when
> the
> button is clicked. From here I can't see what causes this behavior. Try to
> call Me.Close explicitly in the button's click event.
>[color=green]
>> 2. Despite, I still don't know why you want to open an MDI child
>> form from the
>> login form. Is the child form always to be displayed at startup
>> or does it
>> depend on any selection within the login form?
>>
>> Yes, I would like to display MDI child form after successfull login.
>> It depends on user.[/color]
>
>
> There are some design questions involved. The solution I'd probably choose
> is this one:
>
> Public Class App
>
> Private Shared f_Username As String
>
> Public Shared ReadOnly Property Username() As String
> Get
> Return f_Username
> End Get
> End Property
>
> Shared Sub main()
>
> Dim LoginForm As New LoginForm
>
> If LoginForm.ShowD ialog = DialogResult.OK Then
> f_Username = LoginForm.txtUs ername.Text
> LoginForm.Dispo se()
> LoginForm = Nothing
>
> Application.Run (New MDIForm)
> End If
>
> End Sub
>
> End Class
>
>
> I've set the button's dialogresult property in the designer.
>
>
>
> MDIForm:
>
> Private Sub MDIForm_Load( _
> ByVal sender As System.Object, ByVal e As System.EventArg s) _
> Handles MyBase.Load
>
> Select Case App.Username
> '.... open child
> End Select
>
> End Sub
>
>
> Armin
>[/color]
"Simon Abolnar" <Simon.Abolnar@ tscng.net> schrieb[color=blue]
> Well. I still have one little problem.
> If user press OK button, but username or password is invalid, how can
> I found out that login failed in sub main?[/color]
In the button's click event, if you want to keep the Form open, set
Dialogresult = Dialogresult.No ne. If you want to close it but without
continuing the app, set it to Dialogresult.Ca ncel.
Thank you very much once again!
Now I solved all problems!
Simon
"Armin Zingler" <az.nospam@free net.de> wrote in message
news:u%23au6KuW FHA.796@TK2MSFT NGP09.phx.gbl.. .[color=blue]
> "Simon Abolnar" <Simon.Abolnar@ tscng.net> schrieb[color=green]
>> Well. I still have one little problem.
>> If user press OK button, but username or password is invalid, how can
>> I found out that login failed in sub main?[/color]
>
> In the button's click event, if you want to keep the Form open, set
> Dialogresult = Dialogresult.No ne. If you want to close it but without
> continuing the app, set it to Dialogresult.Ca ncel.
>
> Armin[/color]
Comment