Click here to Skip to main content
15,887,135 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: MIDI PLEASE, AGAIN AND AGAIN... Pin
Ray Cassick15-May-04 9:00
Ray Cassick15-May-04 9:00 
GeneralRe: MIDI PLEASE, AGAIN AND AGAIN... Pin
Aaron Eldreth15-May-04 9:39
Aaron Eldreth15-May-04 9:39 
GeneralRe: MIDI PLEASE, AGAIN AND AGAIN... Pin
Ray Cassick15-May-04 9:45
Ray Cassick15-May-04 9:45 
GeneralRe: MIDI PLEASE, AGAIN AND AGAIN... Pin
Aaron Eldreth15-May-04 14:51
Aaron Eldreth15-May-04 14:51 
GeneralPassing information between forms Pin
pj4FarEweDsf14-May-04 14:31
pj4FarEweDsf14-May-04 14:31 
GeneralRe: Passing information between forms Pin
Nick Seng14-May-04 15:28
Nick Seng14-May-04 15:28 
GeneralRe: Passing information between forms Pin
rubdub16-May-04 22:27
rubdub16-May-04 22:27 
GeneralRe: Passing information between forms Pin
pj4FarEweDsf17-May-04 5:31
pj4FarEweDsf17-May-04 5:31 
Here it is -
Some background info for you that was given to me in the C# area

[Google on "Mediator pattern" and "MVC" (or "Model-View-Controller"). If you learn how to use these patterns, you'll never get stuck like this again; your code won't need tricks like passing a form to another form. I recommend "Design Patterns" by the Gang of Four.]

I just went to Microsoft ans sought out "Model-View-Controller"

As for the code. A no brainer once you do it, Key words "once you do it"
Once you have placed this very generic code in the forms and "Shared" class, go to project properties and
set the startup object to "Global" - this is you shared class, you can use this class or whatgever class you use for application prep, tracings and logs.




Option Strict On
Option Explicit On

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Global.postF2()

End Sub


End Class




Option Strict On
Option Explicit On

Public Class Form2
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Hide()
Global.postF1(TextBox1.Text)

End Sub


End Class




Option Strict On
Option Explicit On

Public Class Global
Public Shared f1 As Form1
Public Shared f2 As Form2


Public Shared Sub main()
f1 = New Form1
Application.Run(f1)

End Sub


Public Shared Function postF2() As String
f2 = New Form2
f2.Show()

End Function


Public Shared Function postF1(ByVal post As String) As String
f1.Label1.Text = post

End Function
Generalrowstate changes when sybasecommandbuilder is created Pin
CodeAgnostic14-May-04 9:59
CodeAgnostic14-May-04 9:59 
GeneralConvert e to uppercase Pin
XGaMeS14-May-04 8:46
XGaMeS14-May-04 8:46 
GeneralRe: Convert e to uppercase Pin
Aaron Eldreth14-May-04 10:09
Aaron Eldreth14-May-04 10:09 
GeneralRe: Convert e to uppercase Pin
XGaMeS17-May-04 2:46
XGaMeS17-May-04 2:46 
Generalhelp sending a form to bottom Pin
Stanimir_Stoyanov14-May-04 6:37
Stanimir_Stoyanov14-May-04 6:37 
GeneralRe: help sending a form to bottom Pin
f6414-May-04 7:51
f6414-May-04 7:51 
Generalsending email base on radiobuttonlist selection Pin
devgeez14-May-04 5:49
devgeez14-May-04 5:49 
GeneralRe: sending email base on radiobuttonlist selection Pin
Mike Ellison14-May-04 6:34
Mike Ellison14-May-04 6:34 
GeneralRe: sending email base on radiobuttonlist selection Pin
devgeez21-May-04 3:41
devgeez21-May-04 3:41 
GeneralRe: sending email base on radiobuttonlist selection Pin
Mike Ellison21-May-04 4:21
Mike Ellison21-May-04 4:21 
GeneralRe: sending email base on radiobuttonlist selection Pin
devgeez21-May-04 4:31
devgeez21-May-04 4:31 
GeneralRe: sending email base on radiobuttonlist selection Pin
Mike Ellison21-May-04 6:28
Mike Ellison21-May-04 6:28 
GeneralFile Stream Headache Pin
BMS581914-May-04 5:01
BMS581914-May-04 5:01 
GeneralRe: File Stream Headache Pin
Anonymous16-May-04 11:11
Anonymous16-May-04 11:11 
GeneralRe: File Stream Headache - Permissions Problem ? Pin
BMS581917-May-04 3:34
BMS581917-May-04 3:34 
GeneralPjGrid.ocx - Dragging Tasks Pin
mac_hua14-May-04 3:30
mac_hua14-May-04 3:30 
GeneralSetup project for BHO Pin
Member 86274214-May-04 0:27
Member 86274214-May-04 0:27 

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.