Create A Control Class Rather Than Use A Module For MVC?
Mar 20, 2012
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:
Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
goControl = New MyControlClass()
goControl.sUserID = txtUser.text[code]....
View 1 Replies
ADVERTISEMENT
Jun 11, 2012
Basically, we have three databases to grab data from. One is a SQL Server database, one is an Access database (which is particularly annoying to connect to because we have to map a network drive and such), and the final one will be an Oracle database when IT finally gives us rights.I'm thinking about creating a helper function that makes querying any one of these databases as easy as possible. I want to create a two-dimensional array
Dim myEasyResultArray(10,10) as String
myEasyResultArray = DatabaseHelper("Access", "SELECT * FROM Employee")
Is this a good design decision? Also, how can I have the array be the right size? Can I just do this?
Dim myEasyResultArray = DatabaseHelper("Access", "SELECT * FROM Employee")
Should this be a module or a class? I don't really need to share variables?
View 2 Replies
Aug 7, 2009
This is my vb6 programme for creating recordset in a module. and call it in class
and form
[Code]...
View 4 Replies
Oct 6, 2009
i am working on the MSDN tutorials through virtual labs and am encountering a problem with the very first tutorial regarding consoles. I am required to create two notepad files: Module HelloWorld & Public Class Person which I have done without errors having triple checked them. When the files are created I compile the HelloWorld.vb file and a .exe is created
I follow the rest of the steps and encounter an error when i try to compile the Person.vb file using the line vbc Person.vb/t:library/out:HelloWorldLib.dll as i am getting the following errors:
vbc : Command line error BC2001 : file 'HelloWorld.vb/t:library/out:HelloWorldLib.dll' could not be found
vbc : Command line error BC2008 : no input sources specified
View 2 Replies
Nov 16, 2009
I' ve got a short question concerning BackgroundWorker.Is it possible to have the main code for the BGW in one class and the long process for the BGW (DoWork) in another class or module?
I couldn't find anything helpful on the internet.Here is my code - DoWork in a separate class doesn't work:
[Code]...
View 15 Replies
May 20, 2011
I need to create a class to control a texbox.Basically a keypress event but in a class.
I have a textbox on my form.This is a textbox for the postcode.The postcode is supposed be something along the lines of AA 1234.Not sure if its possible, but i want this to be checked on lostfocus.
I honestly got no idea how to get it to work in a class, or to link it to the textbox.
View 6 Replies
Nov 13, 2009
What is a driver module, and how would I add a class and get the driver module to read from the class.
View 2 Replies
Sep 20, 2010
Is there a (simple) way to connect a textbox, label etc. to a property in a class?I have a project with a complex series of dialogs to enter data into a list of a costum class describing an experiment with many parameters that are stored as properties (both simple variables such as strings and integers, but also more complex ones).I need both to be able to update the list of my experiment class, but also to go the other way to populate the dialogs from the class.It can of course be done outside the class and the dialogs in separate subroutines. This however, quicly becomes unmanagable and hard to maintain as the dialogs and experiment class is expanded with new elements.If there was a simple way to connect say a textbox or label in a dialog with the appropriate property holding the information it would make it much easier.
View 5 Replies
Nov 29, 2011
Is it possible to create a user control with a list of custom class type property? If it is, how can I? The issue is that, in designer mode the property is not displayed in property window. I can add the list on markup but when i switch to the designer mode it gives an error which is 'The user control does not have a public property named BookList'.
View 1 Replies
Jan 12, 2011
Some of my co-workers make extensive use of the VB.net concept of Modules. Unfortunately, I just don't 'get it'. I see no benefit in using modules over shared classes. When would it be preferable to use a module?
View 2 Replies
Jun 17, 2012
Use a DLL rather than a module so that if I updated the DLL it would propagate over all the projects that used it. I want to create a library of functions and subroutines that may be used in many projects (such as my gradient and some error messages).
View 8 Replies
Apr 18, 2011
This is purely a coding practice question concerning VB.NET structures. Where do you keep one?As an example, I've created a structure for the simple purpose of keeping information organized, I'd like this structure to be stand-alone, not belonging to any class so I wouldn't have to access it through SomeClass.MyStructure but rather simply MyStructure. So, do I keep it in a separate class and import it into my namespace? Do I keep it in a module (Static class, essentially)? Do I just make a separate VB.NET code file and place is there (I would like it to live in a separate file). Just to clarify, I need this structure to be accesses by the whole application, not just a single class.
View 1 Replies
Mar 6, 2009
I'm working on a program that I have 90% finish.Its basically validates certain information such as credit card, telephone numbers, name etc...
Im trying to create a separate class 'IsValid'to figure out if the creditcard number is valid (is equal to 12 characters only).
This will be initiated with a "Validate button".I know how to do this in the mainform just using an If statement.
But I'm trying to figure out how to valid date this and return it to the form and possibly change cardnumber.forecolor = color.red
View 7 Replies
Sep 6, 2010
Recently i studied about Module and i think it is a Shared Class and all its members are Shared by default and we can not change that. I have query that is it doing something special that a class can not do ? I have just tried with a simple example and found that classes even do a Module's job.Below is my code:
[Code]...
View 7 Replies
Aug 6, 2011
I got a problem with this piece of [code]...
The problem is that i want to move the >>dim dataLoad...<< to a different file (a config file), but when i move it, i get bunch of errors. And i do call the class/module but still it wont work.
Also the other question is how to download multiple files from a server, so when they are downloaded they stay/ are placed in the corresponding folder.
View 2 Replies
Sep 11, 2011
I am using Joe Mayo's book Visual Studio 2010 A beginners guide and in it he suggests that the default Module Module1 should be replaced with a Class and that it was a hold over from previous versions of VS. How can I change VS's behavior so it defaults to Class Program instead?
View 4 Replies
Oct 31, 2010
Im going through the 2008 Express tutorials on methods and classes. Since the advantage of subs, functions, methods, etc is their reusability, how does one save them and later import them into an application?
Also when one writes a class, how is it tested without being part of a form? Besides testing a class, why would one wants to write a class without a form, if it is to be published for a user?
View 3 Replies
Nov 30, 2011
Currently i am using a class thats created and amended on startup and then passed as needed to other class constructors as needed. Now my project is around 20+ classes i am getting tired of passing each new instance this class. Would a module be more suited?
View 14 Replies
Mar 1, 2010
Any some simple examples of how arrays can be put in a Class Module? The examples should show how the array is used and accessed in a form.
View 3 Replies
Jun 1, 2009
I have been given an ASP.Net assignment at work because I had taken a few courses a couple of years ago. Currently, there are no ASP.Net programmers for me to ask here and I have searched several places (including Pro ASP Net book) to find a solution but have come up empty handed.
I have a class named spErrors which takes the values passed to it. Values passed include the offending page,function/sub, and other values and stores them in property values, then calls Response.Redirect("Errors.aspx") from the page's code behind page. In Errors.aspx, the values of the error/exception trapped in the Catch statement are displayed. This works fine from a web form. My question is, how do I call a web page from a class module?
Each class module has the ErrorHandler() procedure that passes these values to the class object. In the class, there is a Write Only property named Redirect and a method called Execute() which is used to display the error page if the error occurs in another class module. Since Response.Redirect() does not work in a class module, what namespace is needed in order for this to work?
Here is the code I'm using.
In the Catch block.
Catch ex As Exception
Err.Description = ex.Message
ErrorHandler(Err, "function name")
[code]....
View 2 Replies
Jul 13, 2011
When loading the buttons to the class I keep getting the 'Null Reference Exception was unhandled' error. How can I fix it? Here is the code...
Class Module:
Public Class Buttons_Group_Class
Public WithEvents Button_Group As System.Windows.Forms.Button
Sub Button_Group_Click()
[code]....
View 7 Replies
Mar 29, 2010
I have no idea what is going on here but it is strange to say the least.I created a new solution in VS2008Pro under windows 7 This solution has 2 projects one for the pc and one for a CE based device.There is one class module which is shared between the 2 projects.In VS2005 under xp this same basic project worked fine but here I am seeing error messages that appear out of no where.
Example the CE portion flags 3 lines initially 1 related to a file i.o function and 2 others related to socket methods. All three of these were supported in VS2005 using framework 2.0 which is the same framework I am using here. This is just the tip of the ice berg however.If I attempt to run the code it runs fine for the pc client and of course not for the CE device. If I make any kind of change, add a line, comment a line or just add a comment I get lots more errors with odd messages that are not even valid.
In one case after I saved it jumped from 3 errors to 30, in another case to 50 and yet another to 144 errors yet the only errors that were present were the original 3 that were flagged.The ide threw errors like Try Catch must end with matching End Try.Get no longer supported ' apparently referring to the binary file get but here it is used as the get portion of the property.Get must end with matching end get.It also started complaining about functions and data types.For example saying "an is not declared" pointing to the word Boolean Or telling me my functions are not declared point to only 1/2 of the function name.
I do not see any errors in the code and it reports no errors in VS2005 under XP.As a test I tryed adding a new property to the project after it was telling me there were 144 errors. I allowed the ide to do most of the work and when I hit enter the errors went back to 3. Then I saved the project and the errors went to 105 pointing first at the new property just created.
View 5 Replies
Feb 23, 2009
I want to know how can convert (compile) a class module into a .dll file. You can refer to me an article, tutorial or a code sample.
View 1 Replies
May 21, 2011
I have a single solution with 2 projects. One project contains all my forms and some other modules and the other project has 1 module with 1 giant class in it. I try to click on properties and change the output type, but it won't let me make it a Class Library, the only 2 options are "Windows Application" or "Console Application". The startup object is the module, and the project has references to a socket component.
View 2 Replies
Dec 3, 2009
I am trying to convert following code into a VB equivalent so that I can use it with threading my forms and controls.
using
System;
using
System.Collections.Generic;
[code]....
View 3 Replies
Mar 21, 2011
I know this can be done as there are other modules out there that have this, but I'm just not getting it to work.
I have created a custom module for a DotNetNuke site. I want to be able to create a class object within the module to hold the information about that object. I can create the object and everything complies. But when I go to use the object in the code-behind it states that the object is not defined. I'm not really sure where to go from here.
This is the beginning of the View.ascx.vb :
Namespace Modules.VacationForms
Public MustInherit Class View
Inherits PortalModuleBase
[Code].....
I'm really not sure why this is not working. I did download another module code to compare and as far as I can tell everything is the same.
View 2 Replies
May 25, 2011
below is my code to use binarywriter it work fine on class form1 level
[code]...
View 2 Replies
May 9, 2009
I wonder how do I delete a Module or Class or a Form.[code]...
View 10 Replies
May 2, 2009
if anyone knows if I can get a listing of all of the sub/functions in a class/module. Just the definitions (That is, the name, paramaters etc., but not the code).
View 3 Replies
Feb 9, 2010
This questions is for VBers, it's irrelevant in C#.
In VB, when you create a module, all it's fucntions and members are available in the scope without need to type the module name, just like all the VB functions (Rnd, Mid, IIf etc.).
I want to create a module but I should have to explicitly write it's name to access it's members, i.e. it shouldn't be loaded to the scope like a namespace.
Update
For example, I have a Module of extension methods, I don't want all it's members to show up on the scope and in the intellisense.
I want it to be available only by instance.ExtensionMethod().
View 3 Replies