|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
converting from combobox.text to long()Does anyone have a snippet of code that will convert a string to a
long array? I've nearly smashed my head against the wall trying to figure this out. I'm Using vb.net 2005 Pls reply asap. I thaanku all in advance. God bless u. "XML newbie: Urgent pls help!"
<XMLnewbieUrgentplsh***@discussions.microsoft.com> wrote in message news:C67EC88D-AD88-4E2F-AC34-230530B5E05F@microsoft.com... three steps> Does anyone have a snippet of code that will convert a string to a > long array? I've nearly smashed my head against the wall trying to figure > this out. > > I'm Using vb.net 2005 > > Pls reply asap. I thaanku all in advance. God bless u. > first - use the split function to convert the string into an array (of strings) then - redim your long array to the same size as your string array then - iterate through the string array - converting each string into a long (system.convert...) and assigning the value to the associated long array element. HTH Hi,
Thanks a lot for your quick response. Could u pls explain in code what u have mentioned(especially how to do second part) I have a combobox that displays Asset names. I need to pass an array of AssetIDs as long from here(every assetname has assetid) into the following line: doc.LoadXml(EDP.ExportPositions(g_SessionID, cmbStartDateandTime.Text, cmbEndDateandTime.Text, cmbAsset.SelectedText).ToString) as per the follwing function Public Function ExportPositions(ByVal SessionID As String, ByVal StartDateTime As Date, ByVal EndDateTime As Date, <System.Xml.Serialization.XmlArrayItemAttribute("AssetID", IsNullable:=false)> ByVal AssetList() As Long) As Position() Everything is fine, except the cmbAsset.SelectedText. I get the error"can't cast string to an array of long" I have spent 2 weeks on this. I don't know what to do.Pls help God bless u. Show quoteHide quote "Hal Rosser" wrote: > > "XML newbie: Urgent pls help!" > <XMLnewbieUrgentplsh***@discussions.microsoft.com> wrote in message > news:C67EC88D-AD88-4E2F-AC34-230530B5E05F@microsoft.com... > > Does anyone have a snippet of code that will convert a string to a > > long array? I've nearly smashed my head against the wall trying to figure > > this out. > > > > I'm Using vb.net 2005 > > > > Pls reply asap. I thaanku all in advance. God bless u. > > > > three steps > first - use the split function to convert the string into an array (of > strings) > then - redim your long array to the same size as your string array > then - iterate through the string array - converting each string into a long > (system.convert...) and assigning the value to the associated long array > element. > HTH > > >
"VB (9) Rocks" slide show
ADO With SQL Transactions Progressbar and treeview stops refreshing VB doesn't allow temp tables in Stored Procedures? Preventing Explorer Window from Displaying when Pen Drive Inserted Copy files and progressbar upload multiple files sending email when running on diff machine returned 100 on bna request Can anyone convert this to VB? |
|||||||||||||||||||||||