|
-
Mar 13th, 2013, 04:47 AM
#1
Thread Starter
Hyperactive Member
Form.ShowDialog() Hidding problem
i have a form called FrmPtnSrch for search employees
i am call the form in the following manner from other form as modal
Private Sub BtnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSearch.Click
Try
Dim objFrmSrch As New FrmPtnSrch
objFrmSrch.ShowDialog()
If intSrchPtnNo <> 0 Then
txtPtnNo.Text = intSrchPtnNo
txtPtnNm.Text = StrPtnInfo.PName
objFrmSrch.Dispose()
objFrmSrch.Close()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
end sub
i have a button on the fromSrch for searching the employee into the table
and listing them in listview on the FrmSrch form
it is searching the talble and also listing them in the listvew through a private method
after listing it is getting hide or desposing off
i have all ther code i have not writter any were for disposing/closing after listing
-
Mar 13th, 2013, 12:10 PM
#2
Re: Form.ShowDialog() Hidding problem
These two lines probably are not necessary:
objFrmSrch.Dispose()
objFrmSrch.Close()
Aside from that, what is the question?
My usual boring signature: Nothing
 
-
Mar 13th, 2013, 12:51 PM
#3
Addicted Member
Re: Form.ShowDialog() Hidding problem
Please use code tags for posting code. With 450 posts in this forum you should know very well about that by now.
-
Mar 15th, 2013, 11:35 PM
#4
Thread Starter
Hyperactive Member
Re: Form.ShowDialog() Hidding problem
objFrmSrch from is getting displayed but when i click the search button on this form
the fom is automatically either getting hide or disposing off
-
Mar 16th, 2013, 11:46 AM
#5
Re: Form.ShowDialog() Hidding problem
 Originally Posted by yousufkhan
objFrmSrch from is getting displayed but when i click the search button on this form
the fom is automatically either getting hide or disposing off
Yup. That's what a dialog's supposed to do. It sets a value or values then returns to the code in the launching form.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Mar 21st, 2013, 11:30 PM
#6
Thread Starter
Hyperactive Member
Re: Form.ShowDialog() Hidding problem
ofcours it sets the values and then rturn off but its not set the values and getting off
I have a grid on the dialog form in that grid i am getting some record after click on he search button
on double click on the grid i like set values and then the dialog for should get off
-
Mar 21st, 2013, 11:51 PM
#7
Re: Form.ShowDialog() Hidding problem
Obviously English is not your first language but you might try using a bit of punctuation if your posts. If you were to put in a question mark here and there then it would be easier to determine what question you're actually asking as opposed to just making statements.
Basically, you're using a dialogue incorrectly. The proper way to use a dialogue is like this:
vb.net Code:
Using dialogue As New SomeForms
'Pass initial data into the dialogue if required, e.g.
dialogue.SomeProperty = someValue
'Display the dialogue.
If dialogue.ShowDialog() = Windows.Forms.DialogResult.OK Then
'The user clicked OK.
'Get the final data from the dialogue if required, e.g.
someOtherValue = dialogue.SomeOtherProperty
'Use final data if required.
End If
End Using // form is implicitly disposed here
It's up to you to declare those properties in the dialogue form. The dialogue then doesn't have to know anything about the outside world. It is completely self-contained and can therefore be used anywhere in your project without any reliance of a specific form displaying it or the like. If, for instance, your dialogue is displaying data in a ListView for the user to select, the data from the selected item would be what the dialogue exposes via its public properties.
In the dialogue, you set the DialogResult to close it. If the user clicks the OK button or otherwise provides affirmative feedback, e.g. double-clicks an item in a list, then you set the DialogResult to OK and the dialogue will close and ShowDialog returns OK. If the user clicks the Cancel button then you set DialogResult to Cancel. If the user clicks the title bar Close button then DialogResult is automatically set to Cancel.
-
Mar 22nd, 2013, 01:02 AM
#8
Frenzied Member
Re: Form.ShowDialog() Hidding problem
 Originally Posted by MetalInquisitor
Please use code tags for posting code. With 450 posts in this forum you should know very well about that by now.
and with just 38 posts your learning how to be rude and condesending like some others around here mighty quick. Congratulations
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|