Click here to Skip to main content
15,917,808 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralNeed help on monthview control Pin
gamerPotatoe12-Feb-04 19:47
gamerPotatoe12-Feb-04 19:47 
GeneralRe: Need help on monthview control Pin
John Kuhn13-Feb-04 16:13
John Kuhn13-Feb-04 16:13 
GeneralBackground Application Pin
Pugman81212-Feb-04 17:53
Pugman81212-Feb-04 17:53 
GeneralRe: Background Application Pin
John Kuhn12-Feb-04 17:59
John Kuhn12-Feb-04 17:59 
GeneralRe: Background Application Pin
John Kuhn13-Feb-04 13:51
John Kuhn13-Feb-04 13:51 
Questioncan you make an array of properties? Pin
Nadroj12-Feb-04 17:21
Nadroj12-Feb-04 17:21 
AnswerRe: can you make an array of properties? Pin
Nadroj12-Feb-04 17:51
Nadroj12-Feb-04 17:51 
QuestionHow to Load Form2 from Form1 Pin
John Kuhn12-Feb-04 17:13
John Kuhn12-Feb-04 17:13 
Another CPian wrote to me in a separate email, asking "...trying to have a form, that when you click on a command button, the main form comes up. The first one would be an opening form, and the second the main program" I thought I'd post the first solution that occurred to me here, and ask if anyone else has a brighter idea.

Here's what I did. I create two forms, one named StartupForm, and one named MainForm. The form StartupForm is set as the startup object in the project's properties.

StartupForm:

Public Class StartupForm
    Inherits System.Windows.Forms.Form

    ' Windows Form Designer generated code omitted

    Private Sub cmdStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStart.Click
        Dim myForm As New MainForm(Me)  ' MainForm's constructor New is overloaded
        Me.Hide()  ' Make me invisible
        myForm.Show()  ' Display MainForm
    End Sub

End Class

MainForm:

Public Class MainForm
    Inherits System.Windows.Forms.Form

    Private _caller As Object

    ' Windows Form Designer generated code omitted

    Public Sub New(ByVal caller As Form)
        MyBase.New()
        InitializeComponent()
        _caller = caller
    End Sub

    Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClose.Click
        CType(_caller, Form).Close()
        Me.Close()
    End Sub
End Class


This was pretty quick & dirty, so there are probably some obvious enhancements to be made. Suggestions, comments, questions and revisions are invited...
AnswerRe: How to Load Form2 from Form1 Pin
Edbert P12-Feb-04 18:54
Edbert P12-Feb-04 18:54 
GeneralRe: How to Load Form2 from Form1 Pin
John Kuhn12-Feb-04 19:28
John Kuhn12-Feb-04 19:28 
GeneralRe: How to Load Form2 from Form1 Pin
Edbert P15-Feb-04 14:59
Edbert P15-Feb-04 14:59 
GeneralRe: How to Load Form2 from Form1 Pin
John Kuhn16-Feb-04 9:06
John Kuhn16-Feb-04 9:06 
GeneralProblem accessing component from VB Pin
SripriyaBabu11-Feb-04 23:26
SripriyaBabu11-Feb-04 23:26 
GeneralRe: Problem accessing component from VB Pin
Anonymous12-Feb-04 5:05
Anonymous12-Feb-04 5:05 
GeneralUPPERCASE TEXT Pin
Lim Goh Tong11-Feb-04 21:45
Lim Goh Tong11-Feb-04 21:45 
GeneralRe: UPPERCASE TEXT Pin
-Dr_X-12-Feb-04 13:41
-Dr_X-12-Feb-04 13:41 
GeneralUppercase text Pin
Lim Goh Tong11-Feb-04 20:56
Lim Goh Tong11-Feb-04 20:56 
GeneralRe: Uppercase text Pin
Hesham Amin12-Feb-04 11:48
Hesham Amin12-Feb-04 11:48 
GeneralRe: Uppercase text Pin
Matthew Hazlett13-Feb-04 4:19
Matthew Hazlett13-Feb-04 4:19 
GeneralDefault Button in Vb.net Pin
Tasnim11-Feb-04 20:23
Tasnim11-Feb-04 20:23 
GeneralRe: Default Button in Vb.net Pin
John Kuhn11-Feb-04 20:34
John Kuhn11-Feb-04 20:34 
Generaldefault client attachment problem Pin
Asim N.11-Feb-04 17:48
Asim N.11-Feb-04 17:48 
QuestionHow to attach a scroll bar to a picturebox Pin
MJay11-Feb-04 15:44
MJay11-Feb-04 15:44 
AnswerRe: How to attach a scroll bar to a picturebox Pin
Anonymous12-Feb-04 4:46
Anonymous12-Feb-04 4:46 
AnswerRe: How to attach a scroll bar to a picturebox Pin
Anonymous12-Feb-04 4:51
Anonymous12-Feb-04 4:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.