Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Software Development
Tag Cloud
access acer asus bios bsod computer crash desktop dns driver drivers error ethernet excel freeze gaming graphics hard drive hardware hdmi internet laptop malware memory monitor motherboard network printer problem ram registry repair router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Software Development >
vb.net combine forms

Reply  
Thread Tools
-Fabez-'s Avatar
Senior Member with 1,943 posts.
 
Join Date: Jul 2008
Location: Earth
Experience: General
03-Feb-2010, 07:06 AM #16
This following line should be changed to reflect the names of your controls, RadioButton1 for example.

Code:
Dim ControlsToSave() As String = {"Chkbx", "RdoOne", "RdoTwo", "RdoThree"}
nsr1's Avatar
Computer Specs
Member with 58 posts.
 
Join Date: Jul 2009
Experience: Intermediate
03-Feb-2010, 06:27 PM #17
that makes sense
nsr1's Avatar
Computer Specs
Member with 58 posts.
 
Join Date: Jul 2009
Experience: Intermediate
03-Feb-2010, 06:52 PM #18
I get the same result:
Not saving the checkbox state.
-Fabez-'s Avatar
Senior Member with 1,943 posts.
 
Join Date: Jul 2008
Location: Earth
Experience: General
04-Feb-2010, 02:43 PM #19
This piece of code needs attention

Code:
Private Sub Form_close(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Leave
        Dim ControlsToSave() As String = {"Chkbx", "RdoOne", "RdoTwo", "RdoThree"}
 
        Dim ControlStatesFile = FileIO.FileSystem.OpenTextFileWriter("config.txt", False)
        For Each FormControl In Me.Controls
            If Array.LastIndexOf(ControlsToSave, FormControl.name) <> -1 Then
                ControlStatesFile.Write(FormControl.name.ToString + ":" + IIf(FormControl.checked, "True", "False") + vbNewLine)
            End If
        Next
        ControlStatesFile.Flush()
        ControlStatesFile.Close()
        End
    End Sub
As this event is triggered when the form close's, there is no need for the end command. You should move all code from this function to the vent handler for the button, etc that starts the exit procedure. Is the settings file generated in your debug environment?
__________________
Like coding, want help with coding or want to learn coding ? Then the Coders Group is for you
nsr1's Avatar
Computer Specs
Member with 58 posts.
 
Join Date: Jul 2009
Experience: Intermediate
04-Feb-2010, 03:33 PM #20
That worked!
But when i click the close button, both forms close. I'll try to figure it out.
-Fabez-'s Avatar
Senior Member with 1,943 posts.
 
Join Date: Jul 2008
Location: Earth
Experience: General
04-Feb-2010, 05:07 PM #21
Instead of using End, try using Me.Close(), it might make a difference.
nsr1's Avatar
Computer Specs
Member with 58 posts.
 
Join Date: Jul 2009
Experience: Intermediate
04-Feb-2010, 05:11 PM #22
yup, now the "time" values won't go to form1 or form1 isn't seeing form2's checkbox is checked & you have to click the radio button twice to change the selection .
Never ends..hope you don't mind helping a dummy like me lol. I'll put your name in the credits

Last edited by nsr1; 04-Feb-2010 at 05:24 PM..
-Fabez-'s Avatar
Senior Member with 1,943 posts.
 
Join Date: Jul 2008
Location: Earth
Experience: General
04-Feb-2010, 05:24 PM #23
Try closing the second form from the first form when the time values have been retrieved. This will require you to change Me.Close() to FormName.Close()
nsr1's Avatar
Computer Specs
Member with 58 posts.
 
Join Date: Jul 2009
Experience: Intermediate
04-Feb-2010, 05:27 PM #24
when I try form2.close(), it says Error 1 'WindowsApplication1.Form2' cannot refer to itself through its default instance; use 'Me' instead.
-Fabez-'s Avatar
Senior Member with 1,943 posts.
 
Join Date: Jul 2008
Location: Earth
Experience: General
04-Feb-2010, 05:32 PM #25
If the first form does not pass the time variable to the second form when it close's itself, remove the Me.Close() statement from the first form. Then in the function that retrieves the time variable, add FirstFormName.Close()
nsr1's Avatar
Computer Specs
Member with 58 posts.
 
Join Date: Jul 2009
Experience: Intermediate
04-Feb-2010, 05:37 PM #26
Actually, i want the time variable to pass from form2 to form1. form2 is a options pop-up.
-Fabez-'s Avatar
Senior Member with 1,943 posts.
 
Join Date: Jul 2008
Location: Earth
Experience: General
04-Feb-2010, 05:40 PM #27
The same principle applies, just add OtherFormName.Close() to the function on the first form.
nsr1's Avatar
Computer Specs
Member with 58 posts.
 
Join Date: Jul 2009
Experience: Intermediate
05-Feb-2010, 02:40 PM #28
That doesn't work.
Here's the problem:
form1 doesn't see whether checkbox is checked or not & what radio button is checked.
-Fabez-'s Avatar
Senior Member with 1,943 posts.
 
Join Date: Jul 2008
Location: Earth
Experience: General
05-Feb-2010, 02:46 PM #29
How do you know this ? Do you get an error or do the control names not appear in IntelliSense, etc ?
nsr1's Avatar
Computer Specs
Member with 58 posts.
 
Join Date: Jul 2009
Experience: Intermediate
05-Feb-2010, 02:57 PM #30
Form1 code:
Quote:
Public Class Form1

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
WebBrowser1.Navigate("https://www.google.com/voice/m")

End Sub

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Refresh()
End Sub


Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Form2.CheckBox1.CheckState = 0 Then
Timer1.Enabled = False
ElseIf Form2.CheckBox1.CheckState = 1 Then
Timer1.Enabled = True
End If

Dim url As String = "https://www.google.com/voice/m?gse*"

Timer1.Interval = Form2.time

Try
If WebBrowser1.Url.ToString() Like url Or WebBrowser1.Url.ToString() Like "https://www.google.com/voice/m" Or _
WebBrowser1.Url.ToString() Like "https://www.google.com/voice/m/i/sms" Or _
WebBrowser1.Url.ToString() Like "https://www.google.com/voice/m/i/voicemail" Then
Timer1.Enabled = True
WebBrowser1.Refresh()
End If
Catch ex As Exception

End Try


End Sub


Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim F2StayOpen = New Form2()
F2StayOpen.ShowDialog()
End Sub

Private Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
WebBrowser1.Navigate("https://www.google.com/voice/m")
End Sub
End Class
When I comment out If Form2.CheckBox1.CheckState = 0 Then
Timer1.Enabled = False
ElseIf Form2.CheckBox1.CheckState = 1 Then
Timer1.Enabled = True
End If, it will auto refresh every 10 seconds (default time) instead of the user-defined time.
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 09:20 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.