|
-
Mar 20th, 2012, 11:39 AM
#1
Thread Starter
Hyperactive Member
Should I create a Control Class rather than use a Module for MVC?
So I'm a little new to MVC. I'm trying to use it in writing VB.NET Windows Form code.
So I'm thinking, instead of using a VB.NET module, or having code embedded in the forms, I should create my own "Control" Class, to handle all operations and "application" level variables.
Is this the right approach?
Ex:
Code:
Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
goControl = New MyControlClass()
goControl.sUserID = txtUser.text
goControl.sPass = txtPass.text
goControl.login()
Dim lfTemp as New frmMainForm
lfTemp.show()
me.Close()
End Sub
"I like to run on treadmills, because at least I know I'm getting nowhere."
- Me
-
Mar 20th, 2012, 12:46 PM
#2
Re: Should I create a Control Class rather than use a Module for MVC?
vb Code:
Dim goControl as myControlclass goControl = New MyControlClass() goControl.sUserID = txtUser.text goControl.sPass = txtPass.text goControl.login() Dim lfTemp as New frmMainForm lfTemp.show() me.Close()
Looks alright to me. Using classes is an OOP/OOD way to go with .Net
Oh, I added a declaration that then is followed by instantiating a NEW class of the Usercontrol.
You prob already added that elsewhere though, eh?
Good LUCK!~
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
|