By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,887 Members | 1,059 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,887 IT Pros & Developers. It's quick & easy.

converting from combobox.text to long()

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a

"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

P: n/a
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.