converting from combobox.text to long()

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!"
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
 
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.
 
Back
Top