|
-
Feb 27th, 2004, 02:10 AM
#1
Thread Starter
Lively Member
assigning structure
halu,
i don't know if my subject gets the very title of what i wanted. hehe... i wanted to know about something like assigning structure... i encounter this in C... but this gives me error when i try to apply it in VB... code is like this...
Code:
typedef struct{
char code[10],lastname[10],firstname[10],mi,address[10];
int location;
short status;
}salesman;
main(){
salesman s={"01","lastname","firstname",'m',"address",1,1};
printf("%d\n",s.name);
}
is that possible in VB? just want to clarify if vb.net offers this kind of assignment...
something like a structure receiving {data....}
thanx guys...
-
Feb 27th, 2004, 02:23 AM
#2
No not unless you specifically build a constructor with such parameters.
VB Code:
Public Structure MyTest
Dim ID As Integer
Dim Name As String
Sub New(ByVal id As Integer, ByVal name As String)
Me.ID = id
Me.Name = name
End Sub
End Structure
Dim ts As New MyTest(1, "Ed")
MsgBox(ts.ID & " " & ts.Name)
You can only use that syntax {} with assigning items to an array in .net.
VB Code:
Dim sa As String() = {"Ed", "Mike", "Cookie"}
-
Feb 27th, 2004, 02:31 AM
#3
Thread Starter
Lively Member
thanx very much Ed... again, again, and again....
don't know when i'll still be doing that... perhaps if i can code...
again... thanx... can't stop doing that... hehehe...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|