Click here to Skip to main content
15,921,941 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Toolstrip/Menustrip Pin
RichardBerry23-Feb-06 0:12
RichardBerry23-Feb-06 0:12 
QuestionWindows Application type or Console Application type? Pin
Slow Learner22-Feb-06 9:13
Slow Learner22-Feb-06 9:13 
AnswerRe: Windows Application type or Console Application type? Pin
Joshua Quick22-Feb-06 12:47
Joshua Quick22-Feb-06 12:47 
QuestionFilter data in DataGridView Pin
Brian Holdridge22-Feb-06 9:00
Brian Holdridge22-Feb-06 9:00 
AnswerRe: Filter data in DataGridView Pin
RichardBerry22-Feb-06 22:38
RichardBerry22-Feb-06 22:38 
GeneralRe: Filter data in DataGridView Pin
Brian Holdridge24-Feb-06 2:34
Brian Holdridge24-Feb-06 2:34 
QuestionPassing object from one form to another Pin
G7236022-Feb-06 8:52
G7236022-Feb-06 8:52 
AnswerRe: Passing object from one form to another Pin
Joshua Quick22-Feb-06 13:09
Joshua Quick22-Feb-06 13:09 
I see 2 issues here...

1)
Me.frmMainMenu = New MainMenu(user)<br />
Me.frmMainMenu.Show()


The above code needs to be executed inside of a method. You should put it in the Form's load event handler, like this...
Private Sub IMSLogin_Load(ByVal sender As System.Object, _
                          ByVal e As System.EventArgs) _
                          Handles MyBase.Load
   Me.frmMainMenu = New MainMenu(user)
   Me.frmMainMenu.Show()
End Sub

2)
In MainMenu's constructor, you didn't assign the objUser parameter to MainMenu's member variable. You assigned it to a local variable instead, which will be lost as soon as it goes out of scope in the constructor.
You should do this instead...
Private user As User
'
Public Sub New(ByVal objUser As User)
   MyBase.New()
   'This call is required by the Windows Form Designer.
   InitializeComponent()
   '
   user = objUser
End Sub



I also have a couple nit-picky suggestions to make too. Smile | :)

1) You should avoid creating local/member variables having the same name as their type, like you did here.
Private user As User

Instead, call it something like "currentUser" or "loginUser" or whatever. It looks like you were doing a little hungarian notation here, so you could follow suit and call it "m_user" too.

2) You should post fix "Form" to the end of your Form class names. That makes it clear what they are and it'll follow Microsoft's naming guidelines. I think this is especially important for your MainMenu form class, which can easily be confused as a control.
QuestionDatagrids and the Date....... Pin
daviiie22-Feb-06 6:34
daviiie22-Feb-06 6:34 
AnswerRe: Datagrids and the Date....... Pin
RichardBerry22-Feb-06 20:59
RichardBerry22-Feb-06 20:59 
QuestionPassing Arrays of structures from VB.NET to unmanaged C++ Pin
CPop22-Feb-06 6:17
CPop22-Feb-06 6:17 
QuestionHow to use an HttpWebClientProtocol class Pin
Hohnerman2022-Feb-06 6:03
Hohnerman2022-Feb-06 6:03 
QuestionHow do i assign variables in VB.NET? Pin
Slow Learner22-Feb-06 5:26
Slow Learner22-Feb-06 5:26 
AnswerRe: How do i assign variables in VB.NET? Pin
ToddHileHoffer22-Feb-06 5:53
ToddHileHoffer22-Feb-06 5:53 
GeneralRe: How do i assign variables in VB.NET? Pin
Slow Learner22-Feb-06 6:02
Slow Learner22-Feb-06 6:02 
GeneralRe: How do i assign variables in VB.NET? Pin
MohammadAmiry23-Feb-06 5:13
MohammadAmiry23-Feb-06 5:13 
QuestionNeed help on String manipulation Pin
Slow Learner22-Feb-06 5:20
Slow Learner22-Feb-06 5:20 
AnswerRe: Need help on String manipulation Pin
Jason McBurney22-Feb-06 5:23
Jason McBurney22-Feb-06 5:23 
GeneralRe: Need help on String manipulation Pin
Slow Learner22-Feb-06 5:37
Slow Learner22-Feb-06 5:37 
GeneralRe: Need help on String manipulation Pin
Jason McBurney22-Feb-06 5:44
Jason McBurney22-Feb-06 5:44 
GeneralRe: Need help on String manipulation Pin
Slow Learner22-Feb-06 5:52
Slow Learner22-Feb-06 5:52 
GeneralRe: Need help on String manipulation Pin
Jason McBurney22-Feb-06 6:36
Jason McBurney22-Feb-06 6:36 
GeneralRe: Need help on String manipulation Pin
Slow Learner22-Feb-06 8:14
Slow Learner22-Feb-06 8:14 
GeneralRe: Need help on String manipulation Pin
Guffa22-Feb-06 9:53
Guffa22-Feb-06 9:53 
GeneralRe: Need help on String manipulation Pin
Slow Learner22-Feb-06 10:57
Slow Learner22-Feb-06 10:57 

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.