|
-
Jul 25th, 2004, 09:51 AM
#1
Thread Starter
Addicted Member
Create Forms
Example I got these two forms, A and B.
When I click on a date at formA, it should give me formB. Let say the date is 27/4 and wrote something in formB.
When I click on a date(28/4) at formA, it should give me formB, but this time, it is a brand new formB.
I exited formB and return to formA, I click on 27/4, how do I make it to show me back formB which I have written something in ?
-
Jul 25th, 2004, 02:43 PM
#2
PowerPoster
HI,
You need to post the code you are using to instantiate and view form2 and how you get bact to form1 from form2.
I would guess that you have done something like:
In a form2 event:
VB Code:
Dim frm2 As New Form2
frm2.ShowDialog()
Every time you call that event you are creating a new instance of form2, whether or not the previous frm2 has gone out of scope.
It sounds as if what you need is to use a module Sub Main as your startup object and then in the module
VB Code:
Public frm1 As New form1
Public frm2 As New form2
Public Sub Main()
Application.Run(frm1)
End Sub.
In the appropriate event in form1 put:
Now, when you close frm2 it will still be available for the next call of that event. It will NOT have been disposed.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jul 25th, 2004, 02:45 PM
#3
Frenzied Member
post some code.
more than likely, you are instantiating a new form upon clicking that date. You will get a new form each and everytime like that.
-
Jul 25th, 2004, 09:11 PM
#4
Thread Starter
Addicted Member
If test = "one" Then
If (DatePicker1.Value >= DateTime.Today) Then
cf2.TextBox1.Text = CStr(DatePicker1.Value)
cf2.Show()
Me.Hide()
End If
End If
cf2 is form2.
So example DatePicker1.Value is 28/7. Then I did something to it like clicking a label making it disabled.
After that, I click the X button to return to form1 using form2_closing event.
When I'm in form1, I click on 28/7, I want to see the label disabled.
When back to form1, I click on 29/7, it should give me a brand new form2 with the label enabled.
-
Jul 25th, 2004, 11:38 PM
#5
Just when you're 'closing' form2, make sure you save the values corresponding to that date somewhere. This way, when you click on that date again from form1, you only need to pull that data back up again and display it. Else, leave the fields blank.
-
Jul 25th, 2004, 11:49 PM
#6
Thread Starter
Addicted Member
how do i save those datas ??
to ?
-
Jul 25th, 2004, 11:53 PM
#7
to... a database.
Or better, an XML file.
-
Jul 25th, 2004, 11:55 PM
#8
Thread Starter
Addicted Member
yah...how do i save those data to XML ??
i ask that in another post of mine...
-
Jul 25th, 2004, 11:57 PM
#9
Yes, I am currently hopping between the two.
Now whenever you call up form2, make sure you pass a value to it so that you can retrieve its corresponding data.
-
Jul 25th, 2004, 11:59 PM
#10
Thread Starter
Addicted Member
erm...but do pass it to xml ?
-
Jul 26th, 2004, 12:00 AM
#11
Thread Starter
Addicted Member
can i paste my codes to let you see...
-
Jul 26th, 2004, 12:35 AM
#12
Sorry buddy, I'm not understanding you. These last two posts are well, uhm... "uhm".
-
Jul 26th, 2004, 12:46 AM
#13
Thread Starter
Addicted Member
how do i write my things to XML...
then how do i read them from form2 ?
i do not know how to link
-
Jul 26th, 2004, 12:59 AM
#14
-
Jul 26th, 2004, 05:44 AM
#15
PowerPoster
Hi,
There is no need to save ( and no advantage in saving) the data outside of your form objects. The code you posted,
VB Code:
If test = "one" Then
If (DatePicker1.Value >= DateTime.Today) Then
cf2.TextBox1.Text = CStr(DatePicker1.Value)
cf2.Show()
Me.Hide()
End If
End If
works perfectly well. I had no problems when I cut and pasted your coded into a project.
Refer to your latest thread on this subject.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
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
|