469,644 Members | 1,699 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,644 developers. It's quick & easy.

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.

Mar 8 '06 #1
2 2170

"XML newbie: Urgent pls help!"
<XM********************@discussions.microsoft.co m> wrote in message
news:C6**********************************@microsof t.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
Mar 8 '06 #2
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("A ssetID",
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.

"Hal Rosser" wrote:

"XML newbie: Urgent pls help!"
<XM********************@discussions.microsoft.co m> wrote in message
news:C6**********************************@microsof t.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

Mar 8 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Kiteman - Canada | last post: by
2 posts views Thread by Don | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.