473,609 Members | 2,766 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

function to convert string to 1 dimensional array of long

function to convert string to 1 dimensional array of long in VB.Net
Feb 27 '06 #1
5 12706
function to convert string to 1 dimensional array of long in VB.Net


What do you expect that Long array to contain? Character codes? can
you give an example of the expected output for a given input?
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Feb 27 '06 #2
Not exactly sure what you're after, but at a guess you have a comma-delimited
string in your xml file? And you want those values in an array of Long. If
that's the case:

(assume myNode is an XmlNode)

'get the comma-delimited string
'and split it into a string array
Dim temp() As String = myNode.InnerTex t.Split(",")

'convert the string array to an array of long
dim myLongArray() as long
temp.CopyTo(myL ongArray, 0)

'continue processing with myLongArray

HTH

Richard

--

"XML newbie: Urgent pls help!" wrote:
function to convert string to 1 dimensional array of long in VB.Net

Feb 28 '06 #3
Richard,

I had the same idea as Mattias, with this question.

How can you put a string in a long. The only thing I can imaging is to put
every char from a string in a long array, however seems for me a little bit
without sense to convert a codetable depended Unicode datum to long.

Just my thought,

Cor
Feb 28 '06 #4
I am working on application that requires downloading data from the remote
databse by creating a refernce to it's web services.In my GUI, I have a
combobox for table name to query and the starttime and end time to get data
for.Let's suppose I want to query positions table, the function for that in
proxy class is mentioned below, where AssetList is an XML node containing a
list of one or more Assets.Assset is an XML node with the attribute of it's
unique id number.AssetID is the unique identification number of the asset.

This is the function
Public Function ExportPositions (ByVal SessionID As String, ByVal
StartDateTime As Date, ByVal EndDateTime As Date,
<System.Xml.Ser ialization.XmlA rrayItemAttribu te("AssetID",
IsNullable:=fal se)> ByVal AssetList() As Long) As Position()
Dim results() As Object = Me.Invoke("Expo rtPositions", New Object()
{SessionID, StartDateTime, EndDateTime, AssetList})

Return CType(results(0 ),Position())

End Function
I am doing this for download button:

Private Sub btdownload_Clic k(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btdownload.Clic k
'g_SessionID()

'Dim nsmgr As XmlNamespaceMan ager
'nsmgr = New XmlNamespaceMan ager(filterDoc. NameTable)

Dim EDP As ExportData.Expo rtDataWS
EDP = New ExportData.Expo rtDataWS

Dim doc As XmlDocument
doc = New XmlDocument

Dim node As XmlNode

Dim noderead As XmlNodeReader
noderead = New XmlNodeReader(n ode)

'Try
Dim elementnode As String
Dim nodecontents As String
doc.LoadXml(EDP .ExportPosition s(cmbSelectdata .SelectedItem,
cmbStartDateand Time.SelectedTe xt, cmbAsset.Select edIndex))
For Each node In doc
While (noderead.Read( ))

If (noderead.NodeT ype = XmlNodeType.Ele ment) Then

'string elementnode, nodecontents
nodecontents = noderead.ReadSt ring()

If (nodecontents Is Nothing) Then

nodecontents = noderead.Value. ToString()
noderead.ReadOu terXml()

elementnode = noderead.Name
Label2.Text += elementnode + "-" + nodecontents +
"<br>"

End If

End If
End While

Next

My first question is: Can I query the methodGetPositi ons without creating a
combobox for tables? If yes, how.

If no, then I will be using combobox and it's text is in string then how can
I convert it into Long() and put it in the line:
doc.LoadXml(EDP .ExportPosition s(cmbSelectdata .SelectedItem,
cmbStartDateand Time.SelectedTe xt, cmbAsset.Select edIndex))
I thanku all in advance for your time and pls reply asap.It's really urgent...

"XML newbie: Urgent pls help!" wrote:
function to convert string to 1 dimensional array of long in VB.Net

Feb 28 '06 #5
Just a quick note: cmbAsset is a combobox having the list of tables

Now, when I use this is in the following line, I get the error: string can't
be converted to an Array of Long

doc.LoadXml(EDP .ExportPosition s(cmbSelectdata .SelectedItem,
cmbStartDateand Time.SelectedTe xt, cmbAsset.Select edIndex))
"XML newbie: Urgent pls help!" wrote:
I am working on application that requires downloading data from the remote
databse by creating a refernce to it's web services.In my GUI, I have a
combobox for table name to query and the starttime and end time to get data
for.Let's suppose I want to query positions table, the function for that in
proxy class is mentioned below, where AssetList is an XML node containing a
list of one or more Assets.Assset is an XML node with the attribute of it's
unique id number.AssetID is the unique identification number of the asset.

This is the function
Public Function ExportPositions (ByVal SessionID As String, ByVal
StartDateTime As Date, ByVal EndDateTime As Date,
<System.Xml.Ser ialization.XmlA rrayItemAttribu te("AssetID",
IsNullable:=fal se)> ByVal AssetList() As Long) As Position()
Dim results() As Object = Me.Invoke("Expo rtPositions", New Object()
{SessionID, StartDateTime, EndDateTime, AssetList})

Return CType(results(0 ),Position())

End Function
I am doing this for download button:

Private Sub btdownload_Clic k(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btdownload.Clic k
'g_SessionID()

'Dim nsmgr As XmlNamespaceMan ager
'nsmgr = New XmlNamespaceMan ager(filterDoc. NameTable)

Dim EDP As ExportData.Expo rtDataWS
EDP = New ExportData.Expo rtDataWS

Dim doc As XmlDocument
doc = New XmlDocument

Dim node As XmlNode

Dim noderead As XmlNodeReader
noderead = New XmlNodeReader(n ode)

'Try
Dim elementnode As String
Dim nodecontents As String
doc.LoadXml(EDP .ExportPosition s(cmbSelectdata .SelectedItem,
cmbStartDateand Time.SelectedTe xt, cmbAsset.Select edIndex))
For Each node In doc
While (noderead.Read( ))

If (noderead.NodeT ype = XmlNodeType.Ele ment) Then

'string elementnode, nodecontents
nodecontents = noderead.ReadSt ring()

If (nodecontents Is Nothing) Then

nodecontents = noderead.Value. ToString()
noderead.ReadOu terXml()

elementnode = noderead.Name
Label2.Text += elementnode + "-" + nodecontents +
"<br>"

End If

End If
End While

Next

My first question is: Can I query the methodGetPositi ons without creating a
combobox for tables? If yes, how.

If no, then I will be using combobox and it's text is in string then how can
I convert it into Long() and put it in the line:
doc.LoadXml(EDP .ExportPosition s(cmbSelectdata .SelectedItem,
cmbStartDateand Time.SelectedTe xt, cmbAsset.Select edIndex))
I thanku all in advance for your time and pls reply asap.It's really urgent...

"XML newbie: Urgent pls help!" wrote:
function to convert string to 1 dimensional array of long in VB.Net

Feb 28 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1657
by: DJ Craig | last post by:
I have 2-dimensional array with numeric indices for both dimensions, called $results, which contains the search results from a database. The first dimension contains the records, and the second contains the fields. I want to convert it into an XHTML table to echo to the browser. For a 1-dimensional array, I would do this with implode(). Can I use implode() on a 2D array? If not, is there some other function I could use to do this, or...
0
3792
by: Fabster | last post by:
Below is a code part I got somewhere and works fine for retrieving a version from a single file. Now I want to retrieve all .dll, .ocx and ..exe file versions from my harddisk in all directory's. I generate a array of all those files and then in a loop request the version for each of those files. Now it randomly crashes with a error that it cannot write to memory at location xxxxxx. I cannot find the error and adding 'on error goto...
7
1897
by: Hagge | last post by:
I'm stuck in a problem Hi I want to create a funtion in asp. Like this Then the function convert the "custom tag" to. <a href=www.mypage.com/user/Smith>Smith</a> How to do? I'm real stucked. // Hagge
58
10107
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of code... TCHAR myArray; DoStuff(myArray);
3
2073
by: Alex Munk | last post by:
I would like to be able to pass a 2-dimensional array to a function as a string parameter. In the called function I would like to be able to convert the string back into a 2-dimensional array. Example Function1 { int TheArray; Function2(TheArray.ToString(); } Function2 (string parm) { .... In here I would like to be able to convert parm back into a 2-dimensional int array. How do I do this }
8
2465
by: Klaas Vantournhout | last post by:
Hi all, I'm in need of a matrix of function pointers, and to be honest. No 'nice' solution has been found yet on that big big internet. It is possible to declare a matrix of function pointers in the following way void (*f)(int);
4
2497
by: Christian Maier | last post by:
Hi After surfing a while I have still trouble with this array thing. I have the following function and recive a Segmentation fault, how must I code this right?? Thanks Christian Maier
9
2677
by: =?Utf-8?B?RGFya21hbg==?= | last post by:
Hi, I am wondering how you multi-dimension an array function? My declared function looks like this: Public Function GetCustomerList(ByVal Val1 As String, ByVal Val2 As Long, ByVal Val3 As String) As String() Previously I dimensioned a single dimension Array to the size I wanted and
2
4377
by: Jim | last post by:
I'm slowly switching over from VB6 to C# and need help converting an encrypted RC4 string to hex. The function below works perfectly within my vb6 app but I'm having difficulty finding a replacement written in C#. Converting to C# is beyond my skillset at the moment. Where can I find the same function in C#? Thank you Function StrToHex(Text As String, Optional Separator As String = " ") As String
0
8112
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8552
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8510
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8198
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6044
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5503
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4063
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2515
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1636
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.