Home All Groups Group Topic Archive Search About

converting from combobox.text to long()

Author
8 Mar 2006 2:30 AM
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.

Author
8 Mar 2006 3:26 AM
Hal Rosser
"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
Author
8 Mar 2006 6:57 PM
XML newbie: Urgent pls help!
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
>
>
>