Re: Open child form from dialog form

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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@xxxxxxxxxx> wrote in message
news:u8oRcJtWFHA.2128@xxxxxxxxxxxxxxxxxxxxxxx
> "Simon Abolnar" <Simon.Abolnar@xxxxxxxxx> schrieb
>> 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.DialogResult.OK
>>
>> If loginform.ShowDialog = loginform.DialogResult.OK Then
>>
>> Application.Run(New frmReferatNET)
>>
>> End If
>>
>> End Sub
>
>
> 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.
>
>> 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.
>
>
> 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.ShowDialog = DialogResult.OK Then
> f_Username = LoginForm.txtUsername.Text
> LoginForm.Dispose()
> 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.EventArgs) _
> Handles MyBase.Load
>
> Select Case App.Username
> '.... open child
> End Select
>
> End Sub
>
>
> Armin
>


.



Relevant Pages

  • Re: Web Import
    ... I tried to create a small procedure to load a web browser so I could login, ... Sub NextStep() ... .RefreshStyle = xlInsertDeleteCells ... .WebDisableDateRecognition = False ...
    (microsoft.public.excel.programming)
  • Simple Login programming: Authentication does not work for me!
    ... I thought it should be a simple matter to put a login page together after watching LearnVisualNet videos! ... The Login1.Authenticate sub may not be necessary. ... Protected Sub Login1_LoggedIn(ByVal sender As Object, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Secure Multiple Applications in one Domain
    ... Original Page, Login Page, Post of Login Page, Original Page, ... Is using the element in my root web's web.config file the way to ... > another sub application located in the ... Regarding on the repeatly be redirect to login page. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Open child form from dialog form
    ... in sub main or in btnOK ... >> Shared Sub main ... > Dim LoginForm As New LoginForm ... > I've set the button's dialogresult property in the designer. ...
    (microsoft.public.dotnet.languages.vb)