VS 2008 Some Hint About Structure?
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
ADVERTISEMENT
Apr 12, 2010
I have a form with a few buttons on it. I want to show a "hint" whenever the mouse is over one of the buttons.
View 1 Replies
Aug 12, 2011
In my application I have one text box for entering user name. If text is empty i want to show "Enter User name here" in same text box in gray color. Is there any property like this for text box. Like in Firefox browser if URL field is empty it will show "Go to a web site" In gray color
View 3 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
Feb 3, 2011
1.) I would like to cause a Timer.Tick event in code. I know you can use PerformClick to cause a Click event. Is there a way to do the same with a timer?
2.) I have several "TextBoxes" listed as being on a "Form" but they cannot be seen. I have copied and pasted these during the design phase but have renamed the copies since. Is there a way to purge the unseen TextBoxes?
Hint: If you have "Windows 7", at the desktop, press <CTRL><SHIFT> and Rotate the Wheel on the Mouse. This will re-size the Icons on the desktop. "THIS ALSO WORKS IN THE VB2010 IDE" and allows you to Zoom the code window.
View 3 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
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 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 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
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
May 23, 2010
I want to make a structure within a structure. Basically it will appear like this:
Structure ID
dim CardType as string
im CardCode as string
[code]......
View 13 Replies
Oct 12, 2010
In Vb.net I am trying to assign an array of structure to another array of same structure[code]...
View 2 Replies
May 11, 2010
I have a question: How can I make a function or sub run inside a structure when a variable in this structure changes? As example I have this function:
Public Structure Texture
Sub New(ByVal TexturePath As String)
Me.Path = TexturePath
Me.Image = LoadImage(TexturePath)
End Sub
Public Path As String
Public Image As Image
End Structure
And somewhere this happens:
Dim t As New Texture("path ooldfilename.tga")
t.Path = "path o
ewfilename.tga"
I want it to automatically load the image when the "Path" variable changes. Is the only solution making an extra sub and run that? It would really decrease my code size if it changes on variable change.
View 3 Replies
Jun 3, 2010
I desperately seek for a code sample to serialize an array of structure elements to a XML. To serialize a simple object of a structure I used:
Private Sub saveEntries()
Dim FS As New FileStream(path, FileMode.Create)
Dim XS As New XmlSerializer(GetType(personEntry))
XS.Serialize(FS, entries(0)) 'serialize first entry of an array - success
FS.Close()
End Sub
Structure looks like this:
<Serializable()> Public Structure personEntry
Dim name As String
Dim d, m, y As Integer
End Structure
Private path As String = "data_file.xml"
Public entries(2) As personEntry
But how to apply this to an array?
View 5 Replies
Mar 8, 2010
Structure EmployeeData
Dim EmployeeName As String
Dim JobTitle As String
Dim TaxRate As Single
End Structure
[Code] .....
View 5 Replies
May 6, 2009
Okay, I have a structure that contains numerous elements... mostly strings, one or two integers. I maintain an internal array of that structure. The structure contains ONLY data elements, no code.I want to save the data to a file. I know that I CAN use StreamWriter.Writeline()to put out a formatted string for each element in the array. But is there any way to simply open a binary output file and save each structure, one after the other? And conversely, to load the array again in similar fashion? Something similar to this in intent, though I realize the code below doesn't work.
[code]...
To repeat, I want to write an entire structure to a datafile quickly and easily, without having to save each member of each element in the array. And conversely, to read the data back in the same way for easy loading of the array.
View 1 Replies
Apr 25, 2010
I'm running into deep trouble with this structure variable!this is the structure
Structure StuRec
Dim strName As String
Dim strMNum As String
[code]....
the ArrScores() has maximum elements of 10 subscripts so i need to delete one recored of them. but it doesn't really seems to be working?
View 2 Replies
Apr 12, 2010
I have several quesions about reading/writing structures from/to files.In a scenario when I open a data file having its own header and variable data fields I create a structure that represents a header consisting of 9 bytes:
Public Structure HeaderInfo
Public DataField1 As Integer
Public DataField2 As Byte
Public DateField3 As Integer
End Structure
I'm using this code for the time being:
vb.net
Public Function ReadHeader(ByVal FileName As String) As HeaderInfo Dim ReturnInfo As HeaderInfo Try Using br As New IO.BinaryReader(New IO.FileStream(FileName, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)) With ReturnInfo
[code]....
The first question is - can I fill the structure directly somehow? Some structures are very long and filling them this way will be tedious. For example, if I know the length of the structure I could read the needed number of bytes in a byte array and somehow marshal these bytes into the structure.I can use Marshal.PtrToStructure, but then I would need to get an IntPtr of my byte array. I use <Serializable()> attribute for my structure.
View 10 Replies
May 25, 2010
I am totally into structures at this point, mostly because of their simplicity in use. I am now working on a "download structure", which allows you to download and keep track on a file.This is the
Public Structure FileDownload
Sub New(ByVal URL As String, ByVal DestFilePath As String)
Me.URL = URL
[code].....
View 6 Replies
Mar 29, 2010
I am creating labels at runtime. Inside the .tag property I have a structure. Everytime I attempt to update the structure the .tag property doesn't update.
Here is the structure:
Public Structure structChip
Dim kingStatus As Boolean
Dim currentTileLoc As Integer
[Code]....
View 15 Replies
Mar 6, 2009
I am making a class that has a property that I want to be of type System.Drawing.Size. I don't seem to be able to reference system.drawing from within my class, and therefor can't set my property's data type to Size. Anyone know how I might do this?
View 2 Replies
Jan 7, 2012
I have a structure which includes this...
Structure MasterStruct
<VBFixedArray(98)>
End Structure
When I create the code to initialize the Sections array like this...
Dim MasterX as MasterStruct
Dim Temp as Integer
For Temp = 0 To 98
MasterX.Sections(Temp) = 0
Next
VS 2008 tells me that MasterX.Sections "is not an array or method, and cannot have an argument list."
View 6 Replies
Mar 30, 2010
I'm trying to implement for the first time a library. With the event sub "client_TickPrice" I want to update a textbox. However nothing happens to my form when the "UpdateLast" sub is called from there.? The code was originally inside a Module (not a class like now), and set up as a console application. Probably there is a problem with the way I wrap my code, i.e. use of classes etc. This program is supposed to receive realtime stock/futures price data. Is it still a good way to start this code with the form, or should I make some type of console application?
Public Class Form1
Dim prog As New Program
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
prog.Main()
[Code] .....
View 8 Replies