|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Got to be an easier way...Hey all,
struggling to find an easier way to initialize an array of structures... Structure room Public Description as string Public Refridge() as string Public WeaponsVault() as string end structure Dim MyApt() as Room I'd like to find a way similar to init an array of strings like: Dim MyString() as String = {"str1","str2"} Any assist is helpful... wardeaux Hi,
Not too sure I undertood what you are looking for.... Here are my 2 Swiss cents ;-) Structure room Public Description As String Public Refridge() As String Public WeaponsVault() As String Public Sub New(ByVal description As String, ByVal refridge() As String, ByVal weaponsVault() As String) Me.Description = description Me.Refridge = refridge Me.WeaponsVault = weaponsVault End Sub End Structure Dim MyApt As New room("BlahBlah", New String() {"1", "2"}, New String() {"3", "4"}) - José "Wardeaux" <warde***@bellsouth.net> a écrit dans le message de news: %23rFdx37MFHA.3***@TK2MSFTNGP12.phx.gbl...Show quoteHide quote > Hey all, > struggling to find an easier way to initialize an array of structures... > Structure room > Public Description as string > Public Refridge() as string > Public WeaponsVault() as string > end structure > > Dim MyApt() as Room > > I'd like to find a way similar to init an array of strings like: > Dim MyString() as String = {"str1","str2"} > > Any assist is helpful... > wardeaux > > "Wardeaux" <warde***@bellsouth.net> schrieb: \\\> struggling to find an easier way to initialize an array of structures... > Structure room > Public Description as string > Public Refridge() as string > Public WeaponsVault() as string > end structure > > Dim MyApt() as Room > > I'd like to find a way similar to init an array of strings like: > Dim MyString() as String = {"str1","str2"} Dim MyApt() As Room = {New Room(), New Room()} /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> > I'd like to find a way similar to init an array of strings like: I don't tend to use Structure in VB.NET but they are pretty similar to > Dim MyString() as String = {"str1","str2"} classes so I'd use something like this: Module Module1 Sub Main() Dim Rooms() As Room = _ { _ New Room("Lounge", "Yes", "No"), _ New Room("Kitchen", "Bilko", "Womble") _ } For Each Room As Room In Rooms Console.WriteLine(Room.Description) Next End Sub End Module Public Class Room Public Description As String Public Refridge As String Public WeaponsDefault As String Sub New(ByVal Description As String, ByVal Refridge As String, ByVal WeaponsDefault As String) Me.Description = Description Me.Refridge = Refridge Me.WeaponsDefault = WeaponsDefault End Sub End Class
FindWindow API
compression of a string , but must be interoptable someone an idea ?? FileSystemObject vs System.IO.File Array of Hash Tables Problems with the PrintPreviewControl, PrintPreviewDialog controls VB to C# the project location is not fully trusted by .net runtime Query database in VB.NET [String] Pass an array to javascript |
|||||||||||||||||||||||