Trying to read the OBJECTDESCRIPTOR on the clipboard. Almost get it. My guess I don't know how to Marshall the structure. I definetly don't know how to handle: ..."null-terminated string whose offset in bytes is specified in the dwSrcOfCopy "Getting this returned variable length string is what I need help with.
Module Module1 Public Structure structure1 Public TRANS() As structure2 End Structure Public Structure structure2 Public X() As Integer End Structure End Module
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.
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
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">
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?
I found out that you cannot set the array size for a structure when you are making it, i.e
[Code]...
I have to fix this by making a variable with type made by Structure bullet and then redimming it, i.e
[Code]...
This means for every variable with the bullet type i create i have to redim. Is there a way i can set the size of .mesh with .capacity for every single variable created with the bullet type automatically?
I am upgrading a project from VB6 to VB.NET. Unfortunately, I cannot include the DLL or even the name of the DLL that I am using here, I am under a confidentiality agreement. However, I hope I can post enough info here to get this frustrating problem solved.
In VB.net: Code:
So, if I run it as such, it errors out while calling SetParameters saying The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
If I comment out the line m_Parameters.SProperties = New S_Properties(9) {...}, then it does not error out, however the function returns 0, which means it did not actually set the parameters to the device. Trying to ReDim SParameters(9) will also give the hresult error. Doing it with my example above, I put a watch on m_Parameters in both VB6 and VB.net and they look IDENTICAL. All data is the same. Why would I get this ArgumentException in VB.NET and not in VB6 when I am passing in the exact same arguments as in VB6?
Public Structure LogicalEdge Dim sTypeEdge As String Dim dTotalLengthOfLines As Double Dim lstLinesInEdge As List(Of Line) End Structure
In my code, I create a new list of this LogicalEdge:
Dim myListOfEdges As List(Of LogicalEdge) = New List(Of LogicalEdge)
After, I create a new LogicalEdgecontainer:
LogicalEdge = New LogicalEdge
I set one of it's properties:
LogicalEdge.sTypeEdge = "endcap"
Now, I add it to the list
myListOfEdges.Add(LogicalEdge)
After looping a few times, i want to set one of the other propterties for the same item in my LogicalEdge, but when i do this:
LogicalEdge.dTotalLengthOfLines = 80.77
To look at the values in the collection, I loop through myListOfEdges collection; and I see that dTotalLengthOfLines doesn't pick up the value i have assigned to it. i thought I might need to identify which item in myListOfEdges to add it to... so i tried this:
I'm sure there is an answer to this somewhere but I'm clearly using the wrong terminology in my searches, so I apologise in advance for this inevitably being a duplicate.Take the function CType. Clearly I can cast (or at least try) a given object to a given reference type. The function will not work if trying to cast to a structure, i.e.CType(myObject, Integer)
will generate a compiler error. This I'm sure most often crops up when working with generics:
[Code]...
What is the opposite? I want only reference types so that CType doesn't fail. I can't overload the T As Structure with a plain T because it considers them identical signatures, so surely there's a keyword I'm missing somewhere?
Recently I found that I'm not able to instantiate a structure for an array:
Dim mObjectLists() As New objectLayout
Ok, fair but It's an easy way to store a bunch of data in an array instead define a class. And after that I tried to define this:
Dim mObjectLists() As Collection
And add structures to the collection. But it says you should instantiate the reference object first. I searched about creating own Collection based on the base collection class but I think It's wasting time to write a code with class inheritance instead the first sample.
In a recent project I was working I created a structure in my class to solve a problem I was having, as a colleague was looking over my shoulder he looked derisively at the structure and said "move it into a class". I didn't have any argument for not moving it into a class other than I only need it in this class but this kind of falls down because couldn't I make it a nested class?
I need to convert structure from VB6 to VB.Net. This struct is used to pass to a c++ dll. The problem is that the following struct size in VB is 113, but for some reason in VB.Net is 116.
I have an unmanaged C++ dll that I am using in my program. I have successfully used several functions using DllImport. I have run into a problem with one function that takes a structure as input. I originally tried building a structure to pass to the function, but this was unsucessful. So i created a class to define the needed structure. When I pass this, I get no error message, but also no data is passed back to this variable. I have a C++ example of how to use this function, but I don't know how this translates to VB 2005. Here is how they call it in C++ .
Code: Public Structure StrFolder Public isActive As Boolean Public NameFolder As String[code]....
I would like to retrieve and print each variable name within a given structure (not its value). For example:
StrFolder(0).Name should print "isActive" StrFolder(1).Name should print "NameFolder" StrFolder(2).Name should print "URLIDNumber" StrFolder(3).Name should print "DateOfFolder" etc..
I would also like to know each type of an item within a structure. For example:
StrFolder(0).Type should print "Boolean" StrFolder(1).Type should print "String" StrFolder(2).Type should print "Integer" StrFolder(3).Type should print "String" etc..
What is the best way to get a structure from memory, I know the format:
[Code]...
The structure is 53 bytes until the chat text, the message length is determined by one of the structure variables LineLength, so what is the best way to get that and put into into a structure?
I have a structure with types ranging from thread's to control.what im looking for is a easy way to iterate through those item like For eachbut i couldn't get for each to workis there a way to do it
I'm sure I need to do a for each <something> in my something..but I cant figure out what..I kinda want to make a trace program for my structure so I can loop through and split out the name and the value in it..
I have an array structure called Survey and I'm attempting to loop through all the data and get it printed out. I'm trying to follow the example in my text but I must have something different.Here is my basic structure:
Structure Survey Dim ID_Code As Integer Dim Members As Integer
[code]....
I'm not understanding how to fix? The objects and properties to the right of "Family Size: " are getting errors saying "Value of type Integer cannot be converted to System.Drawing.Font.
I have a list of a few thousand names. I actually have last name, first name, phone number, etc and more info. I'm going to make a class to contain the data. so I'll have like a people object with for example a last name field. I'm going to store these in like an array list. Lets say i have 100 items in array list. Maybe last name smith is on index 3 21 and 63. I'd like a data structure where i can easily search for smith and get indexes 3 21 and 63. Brute force is simply loop through complete array checking last name and grabbing index each time i find smith. Ideally id like to have more efficiency. In c++ I'd use a multi map but i don't see that that exists in vb.net. A dictionary wont work because its 1:1.Name of data structure, short description of how to use it and web help reference page would be nice.
I'm writing a test application in order to figure out how to serialize a structure to XML. I can not get the following code to work for me and it's not obvious to me.
The following defines the structures I am attempting to serialize. I think I have the xml decoration correct - but the errors I'm receiving (see below) don't really give me much information.
Imports System.IO Imports System.Xml.Serialization Public Module modTestSerialization
explain what I need to do at the bottom here? I can not figure out what is meant by setting the element of the structure to the value.. Option Strict On
I'm just learning about Structures and so I have created one, but now i want to find out if it contains a line that I placed into itHere's my structure:
Public Structure aLine Dim IsEdge As Boolean Dim myLine As Line