Array Structs Definition?
Aug 2, 2011i'm lost on how to do this inline.It's easy to say
Dim X as Integer = new Integer(4) {1,2,3,4}
but i'm lost on:
Structure ThisType
[code]....
i'm lost on how to do this inline.It's easy to say
Dim X as Integer = new Integer(4) {1,2,3,4}
but i'm lost on:
Structure ThisType
[code]....
I need assistance generating a xml file by reading values from an array of structs.
my struct looks like this:
public structure myStruct
dim ID as int
dim myArray1 as boolean
dim myArray2 as boolean
dim myArray3 as boolean
dim x as int
dim y as int
I have several instances of these structs. I also have universal variables that are declared outside of the structs. I am looking to generate a xml file like this:
[Code]...
But how would I assign the values of each element by reading them in from the struct? Or do I need to use the XmlSerializer Class instead?
I have an assignment where I must read the information from a text file into an array of structs, so that when a part number is input, the correct price will be displayed.
the file is a text file named shoeinfo.txt
it looks like this: BZB34,40.99
BZJ25,54.50
JMM97,14.99
[Code].....
unfortunately I am unable to figure out how the code is to be read into the array. i.e. item(0).partnum = BZB34 item(0).price = 4099D
I have been searching for a while now, but I still can't seem to figure this out. I wrote a rather large program, and to make things more efficient I started to create structs to store more info in a variable.All was well replacing my old code with new code, till I reached a certain point and found that blindly using a loop of integers to access the indexes of the array wouldn't work anymore... I need to access a specific struct by the information contained in a single variable within the struct (like a hashtable key), but can't seem to figure out how.
Is it possible for me to go through my array indexes in a fashion like this?:
Dim myArray(TableCount) As myStruct
Dim TableName As String = "SomeTable"
[code].....
How do I creat a simple array of class definitions?[code]...
View 13 RepliesI'm really struggling with the following pinvoke call. I've tried numerous different ways of doing this but still no joy. The call runs through, but I get a 'Bad parameter' message back with suggests there is something wrong with the struct, since I've ran through a c++ example of this code and the parameters are all correct.
[Code]...
i am using vb.net and i would to send some structs to a C++ tcp server.The problem is the structs i am sending might contain other structs.[code]Lets say i want to send FirstStruct over to the C++ Server.
View 2 RepliesI'm working on some interpo between VB6 and VB.NET and I've hit (another?) brick wall.I need to pass an array of "stuff" between VB6 and VB.NET. This contains an ADO recordset and 4 string values. There could be any number of these 5 items passed, so they will have to be an array of whatever.Seemed to me that in VB I should create a Type and in .NET a Struct, then it should be easy. However...
On running the VB app it fails to start with an error "Function or interface marked as restricted, or the function uses automation type not supported in Visual Basic"
[Code]...
That is the question. Is there anything you can do with c++ unions that you can't with c# Explicit structs?
View 3 RepliesI would like to store references to a bunch of structs in a collection. The general scaffolding looks like this:
Structure myStructType
Dim prop1 as String
Dim prop2 as int
End Structure
[Code]....
now this doesn't work, because it's referencing the same memory. What I would really want is the 'pass reference by value' behaviour that is also used for reference types, so that I can easily keep producing more of them.
Is there any way to fix this other than to make the structs into classes? Is this actually a proper way to use structs, or do I have it all wrong?
I just converted the following code from c# to vb.net. It is functional and works correctly with my company's firmware/devices. My next challenge. Previous serialport code used much more readable structs which where then converted (after building a packet) into byte() automatically as part of the serialport encoding. (this is my understanding)How could I
1. morph byte arrays 'ToSocket' and 'ToMTP' below into structs and
2. convert into byte array for Socket.BeginSend(byte(),.....) to stream out to remote devices?
Imports System.ComponentModel
Imports System.Text
Imports System.Net.Sockets
[Code]....
I'm facing really strange problem, in one of my BLL files whenever I add method or property i get this message Error1'CPLogic.BLL.OrdersFaxGroups' does not contain a definition for 'GetFaxGroupForStatusCheck'C:CouponphoneAppsCPFaxEngineCPFaxEngineCPFaxEngineFaxEngine.cs20658CPFaxEngine I know that the method is in that file, i even able to build the application with success but when ever i try to lanuch it i get this message, the same thing happend to me yesterday in the same file, i ended up deleting it and copy its content again to new file with the same name. but now even that not working..
View 4 RepliesWhen you want to define a type you must say GetType(Type) ex.: GetType(string), but ain't String a type itself? Why do you need to use GetType in those situations? And, if the reason is because it is expecting a Type 'Type'... why isn't the conversion implicit... I mean, all the data is there...
View 4 RepliesI know that in WPF, FontSize = 1/96 of an inch (same as 1 pixel I think). Is the FontSize dimension the height, the width, or diagonal size of a character? I would guess it's the font height, but the Microsoft documentation doesn't really indicate what it is.
Also, is there an easy way to get the height and width of a font size?So it looks like the FontSize is the height, and the width can only be determined (without knowing the actual character) on monospaced fonts since proportional fonts have varying widths.
When I right-click on function name and then press "go to definition" it takes me to the function definition. Is there any way to do this with just one click on function name,., is there some option ,or add-on for VB? that will be perfect, fast and furious
View 2 RepliesI right-click on function name and then press "go to definition" it takes me to the function definition. Is there any way to do this with just one click on function name,., is there some option ,or add-on for VB? that will be perfect, fast and furious
View 1 RepliesI made a copy of a program so I could 'play around' with modifying it. The copy is in a different project in the same solution, plus I renamed it so there shouldn't be a conflict-so why is Go To Definition not available in the copy? It's active in the original (and other programs) but grayed out in the copy. I've rebuilt the entire solution, including the copied program-and it still doesn't work.
View 1 RepliesI noticed in the code base I have to read that sometimes property definition includes an empty (). What's the meaning of that? And it has nothing to do with arrays.
For example :
Public Property TotalPages() As Integer
I have an .XSD that is made from a class so that I can pass to a webservice. It got it over to the webservice as an XMLSchema object and now I need to make it into a class so that I can make objects out of it on the webservice side. I know that XSD.exe is the answer but I'll be darned if I can puzzle out exactly how to implement this thing. I need it to do this conversion at run time so I need to put the code for it into my project and all the references I've seen to using XSD.exe talk about calling it from the command line.
My .XSD is below.
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="[URL]">
<xs:element name="Field">
[Code] .....
In my project this is living in an XMLSchema object. How do I turn it into a class?
I have a class definition that I've seen other define properties that return collections of objects.
Public Property GetAllAdults() as Adults End Property I made the argument that this should be a method in the class, because it doesn't define an attribute of the class, and could not be extended with parameters. Is/Are there reasons why this should be defined as a property vs. a function?
When I specify <SoapDocumentMethod(OneWay:=True)> on my webservice it doesn't seem to get called. If I remove that the webservice works properly. Also, everything works fine on the development machine just not on the server.
Here is my web method:
<SoapDocumentMethod(OneWay:=True)> _
<WebMethod()> _
Public Sub Write(ByVal processGroupId As Integer)
xslClass.xslHelper.writeDatabase(processGroupId)
End Sub
[code]....
i have a probleam with my report , i try to display my report using report viewer but it show an error :The source of the report is not definition has be not specified. i am using visual studio 2005 and databse sql 2005.
View 1 RepliesWhy only the first parameter in the definition of VB.NET Generics uses the 'Of' keyword ?
For example I have here the the full code that LINQ uses for the Enumerable.Select() method :
<System.Runtime.CompilerServices.Extension()> _
Public Shared Function [Select](Of TSource, TResult)(
ByVal source As IEnumerable(Of TSource),
ByVal selector As Func(Of TSource, TResult)
) As IEnumerable(Of TResult)
[Code]...
I'm having trouble with the definition of an inherited generic class. I have two base classes that are defined like this:[code]
View 2 RepliesLet say I am working in a code window, and I want to check for variable, so I right click on it and click on "Go To Definition", after that I want to get back to the place I was working in.
View 2 RepliesThis is what my error list and the correspond lines shows( all of these are showing in the designer code), I tried 3 days to solve it, well after tried lots ways still wrong, I came here.
View 6 RepliesWhat is the meaning of the square brackets around the name of a property in the definition ?
Example :
Public Property [Date] As String
I'm working a business layer (separate assembly) that will contain various business entities used in multiple client applications. One of the client applications is a WCF app that will need to serialize these entities. In order to properly serialize the entities, metadata for data contracts or for XML serialization must be added, but the serialization requirements may vary across applications.
Clearly I need the metadata separated from the class definition. So how do I add metadata to my entities for each separate application?
I call upon the VB ninjas out there. Here's my situation. I need to eventually be able to pass multiple models to a view. Currently I have a linq to sql class that, of course, has a bunch of generated model definitions. I need to make a model that implements multiple models. I somewhat understand how to do this in C#, but this project is testing my VB skillz. Here's some snippets from my linq to sql models. I need to combine these two into one model to pass to the view.
[Code]...
I have a base class which needs to define an enumeration:
BaseClass
- SomeEnum
I then need to create two derived classes from the base class and extend the values in the enumeration:
ChildClass1 : BaseClass
- SomeEnum
- SomeEnumValue1
[code]....
In C# or VB.NET can someone provide the syntax to do this?