[2008] Getting Structure Outside Module?
Feb 27, 2009
I am using Visual Basic .NET 2008. I have a module in my project and couple of windows forms. Now in my module I wrote -
Structure Transport
Dim Veh as Vehicle ' pointing to enum below
Dim GoAhead as boolean
End Structure
[code]....
What I want is that another form should be able to call my sub Select (declared as public) and pass enum data declared in Transport structure. VB allows me to do that if my sub is private but not if my sub is public. To overcome this issue one solution is to declare the enum in the form class itself. But for this I will have to do it in each form.
View 2 Replies
ADVERTISEMENT
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
Nov 27, 2008
Define a structure named product, The structure should contain 2 variables one as a string and the other as a decimal. The decimal is used to store the price and the string is used to store the item number.
Declare a module level array that contains 5 product structure variables
Code the main forms load event procedure so that it reads the item number and prices from the itemInfo.txt file The procedure should store the item numbers and prices in the module level array. It also should add the item numbers to the list box.
When the user selects an item in the list box the items price should appear in the xPriceLabel. code the appropriate procedure.
The code I have is as follows
' Project name: Glovers Project
' Project purpose: The project displays the price of an item.
' Created/revised: <your name> on <current date>
[Code].....
Seems the problem I am having is this line is returning a value less than 0.
itemprice = (itemnumber.Substring(productIndex, newLineIndex - productIndex))
View 4 Replies
Feb 2, 2009
How I would use a search procedure for a text changed event to look at a structure in module.
View 2 Replies
Apr 25, 2010
I'm having a problem that's driving me crazy; I can't understand how to convert the XML structure into a class structure (that I want to use to hydrate a XML document).
The XML document looks like this:
xml
<?xml version="1.0" encoding="utf-8"?>
<artists xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.spotify.com/ns/music/1">
[code]....
View 2 Replies
Jan 5, 2012
Module Module1
Public Structure structure1
Public TRANS() As structure2
End Structure
Public Structure structure2
Public X() As Integer
End Structure
End Module
View 17 Replies
Aug 16, 2010
how we can declare a connectionstring in a module and call that module
View 1 Replies
Jan 5, 2010
I'm new to VB 2008 after having spent a long time with VB6, so I apologize if this is a stupid question. But I'd really like to have this straightened out.
Let's say I have a pretty large structure that has lots of properties.
Code:
Now say that I want an internal database with about 10 instances of this structure total, describing, say, 10 different products that a store sells. When these values are loaded from a database, they remain totally static. (However, they can be different each time a program loads)
Now say that I have a class. Each instance of this class is a type of that BaseProduct structure. Meaning, each instance of the class pertains to one of the 10 types of products that the store sells. However, this class has additional properties that pertain specifically to each instance, which are not static.
Code:
Now, the problem here is... If I have 200 different transactions, each one contains an instance of BaseProduct. BaseProduct is HUGE, and is largely redundant (only 10 types possible), so I think it's a little silly to include a whole copy of it with EVERY transaction. However, the Transaction class really needs information regarding the base product it pertains to. Is there a way to, instead of declaring a New BaseProduct in the Transaction class, to simply make one of the properties of the Transaction class a pointer to a BaseProduct variable?
In VB6, I would accomplish this by making a BaseProduct(10) array, and then giving each Transaction an ID number referring to an entry in that array. But in VB 2008, using class structure, this is impossible. I can't define the BaseProduct(10) array outside of a class in a namespace, and if I define it in the actual application's form, then the class loses modularity since it relies on the application that's using it.
View 11 Replies
Aug 29, 2009
I am trying to communicate with an external device and i am trying to send a byte array to the external device via sockets but i am always getting a response the message size is too small so i am not sure what i have done wrong. Between the data type there should be no alignment present and all numbers are represented in little endian format. The char array is not null terminated as mentioned in the protocol specifications.
I have to send data based on a struct that embeds 2 other struct. So here's my vb.net code for the struct used to convert to byte array and the sending part.
Public Structure MESSAGETYPE_OIP_Login
Dim Header() As COMMANDHEADER
Dim UserName() As PSTRING
[Code]....
View 2 Replies
Apr 14, 2012
I'm experiencing a problem with the following c-structure:
typedef struct tagTEXTUREPROP
{
DWORD dwSize;
[Code].....
The Marshal.SizeOf obviously calculates a size of 76 and it works with the DLL function, but it leaves me with some bad feelings.
View 1 Replies
Apr 27, 2012
I have a VB.Net interface that communicates with an Access 2k3 Database using this module:
Module MOD_ENGINE
'Declare Database connections controls
Dim con As New OleDb.OleDbConnection
Dim dbProvider, dbSource As String
[code]....
I want to call EngineConnect procedure from MOD_ENGINE module into popCboBox module so I can ignate the engine!
View 3 Replies
Jul 8, 2009
Im on Chaper 10 of Microsoft Visual Basic 2008 Step By Step, and I just dont understand how a module works. Ive the chaper over and over and i still don't get it.
View 12 Replies
Jun 11, 2010
What I'd like to is get the name of the current Module running in a VB app. If I am in a Form, I can use "Me.Name", but in a Module that will not work. I tried: System.Reflection.Assembly.GetExecutingAssembly().GetModules()(0).Name But that gives the name of the app (like "WindowsApplication1.exe") rather than "Module1", which is what I'd be looking for.
View 2 Replies
Jul 21, 2009
passing values from the main form.
I've tried declaring the array globally in the module The array() is going to be used in other forms as well.
View 4 Replies
Oct 11, 2009
How to make backgroundworker work on the login module??My form have progressbar with Marquee style...
Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
lblProgress.Visible = True
[code].....
View 6 Replies
Jul 13, 2011
I have the following statement and the function 'InitialiseOsTransform' is in a Module which is in the project.
If InitialiseOsTransform() = False Then But instead of the code going into this function it goes into the Paint function.
I have used the similar code in another project and it works correctly.
View 11 Replies
Jun 7, 2009
I'm making a simple window that bounces around the screen (no reason, just for fun). I can make it work when the moving code is in a Timer_Tick event in the form, but now that I try to move it out to a module, it won't work. Here's what I have:
[Code]....
I try to call it with Bounce(Me) but the form doesn't move. I added a Debug.WriteLine(form.Location) at the end of the sub, and it shows that the location is not changing.
View 7 Replies
Apr 3, 2012
how to create a structure in Visual Basic?r example:
Public SCARD_READERSTATE()
Dim szReader As String 'reader name
Dim pvUserData As Long 'user defined data
[code]....
I'm using Microsoft Visual Basic 2008.
View 2 Replies
Aug 8, 2009
I want to know that how we access a constant which is declared in a public structure, with an instance of that structure?
View 7 Replies
Jul 29, 2009
I want to pick specific elements from DateTime and assign them to variables: Year, Month, Day, Hour, Minute, and Second. In MSDN, I saw ways to assign it all, but not what I needed.
Can anyone one give a hint, or two?
View 4 Replies
Mar 13, 2010
Im triing to use structures.example
Public Structure Column
Dim ID As Integer
Dim Name String
Dim Birth As Date
End Structure
1) Is possible know how many element are in the structure?
2) is possible retrive the type of the data inside a structure? (Integer, String, Date)
3) is possible scan the element without use their name (by using an index as in the string) instead of use Column.ID=1 ? If the none of the questions are positive, what other stuff should i use that allow me to do that?
View 6 Replies
Mar 31, 2011
The General TreeView Structure, with the level indicated in the left.[code...]
Leaving the 0 and 1 levels, the other levels has to be treated as above. How to achieve this?
View 5 Replies
Oct 11, 2009
I'm trying to use my own structure as a dynamic array (ArrayList?) but can't find the right syntax.
Public Structure BLsCompsRootDir
Public BL As String
Public Component As String
[code].....
View 7 Replies
Sep 23, 2011
writing an XML-formatted string so that I may later encrypt it.If I create an XMLDocument,it will insert its formatting tag <?xml version="1.0" encoding="Windows-1252"?> and I need to avoid this.I'm not very familiar with streams, or how to output an XMLWriter to one.
View 3 Replies
Feb 4, 2009
I am coding in vb.net. I want to achieve something like this (sample) -
Structure Transport
Dim land as L
Dim Air as A
[CODE]...
But though i can create enum but how can I embedd it in structure. It is not allowing me to do that.
View 2 Replies
Jun 22, 2010
How to make module to vb.net 2008 and using mysql database
View 1 Replies
Feb 25, 2010
Does anyone know how I can remove a module from a project in vb express 2008 without physically deleting the module?
View 5 Replies
May 4, 2009
I have a project that calls for just a ton of forms and I'd like them all centered on screen. Any way to call this in a module? Just trying to minimize the code necessary for each form. This is the basic centering I use now, only it's in each form_load.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim xLoc As Integer = (Screen.PrimaryScreen.Bounds.Width - Me.Width) 2
Dim yLoc As Integer = (Screen.PrimaryScreen.Bounds.Height - Me.Height) 2
Me.Location = New Point(xLoc, yLoc)
End Sub
View 3 Replies
Jan 17, 2012
I have an VB.net Login Module and what I want to do in this module is to know whether the account being logged in is being used or it's online
Ex: If I logged in then it will say "User is already logged in" etc etc...
View 6 Replies
Aug 25, 2009
I have a Sub Routine in a module to iterate controls on a form. I get an error about an instance of the object not created.I have declared the object and set it to the form (ModelsBox = Me). I have done this between two forms previously. Is there something fundamental that I am missing. Is this where the "Friend Shared" comes into play?
[Code]...
View 2 Replies