Difference Between Int.Parse( ) & Convert.ToInt32( ) ?
Jun 18, 2010C#: Difference between int.Parse( ) & Convert.ToInt32( ) ?And Which one we have to use on what cases--
View 15 RepliesC#: Difference between int.Parse( ) & Convert.ToInt32( ) ?And Which one we have to use on what cases--
View 15 RepliesWhatd does following code do in VB?
Convert.ToInt32(rmaValidationCode.ToCharArray().GetValue(0), 16) Mod 2) = 1
note :Private rmaValidationCode As String
The function "Convert.ToInt32" returns my an integer increased by 48. My operating system is Windows Vista with 32 bit.Here a code, where the bug will be called:
Module Main
Sub Read(ByVal Text As String, ByRef Value As Integer)
Console.Write(Text)
[code]....
[Code]...
I get an error on "colorNumber" in the line/ colorNumber = Convert.ToInt32(TextBox1.Text) It says expression is a value and can't be target of statement. What does that mean? Then how can I change the target?
I am very surprised to see the output of the function with the given value ,DateTime.Parse("08/19/2011 11:32"). I am using VS2008. Always it returns 08/19/2011 11:32 AM. and if the pass value would be 08/19/2011 14:23 then the output value would be 08/19/2011 02:23 PM. But sometimes it is returning 08/19/2011 11:32 PM for DateTime.Parse("08/19/2011 11:32"). Why?
View 3 RepliesMany times i was not getting correct output,then i put .tostring() at the end then it gave good output.so basically why do v need this?also Convert.ToInt32(cmd.ExecuteScalar()) why convert to int32?
View 1 RepliesI just want to parse simple expressions like IIF(FVAL(PFC) = TRUE, (IIF((ORGVAL(BAS, "2012/12/31") + ORGVAL(DA)) < 6500, (FVAL(BAS) + FVAL(DA)) * 12%, 780)), 0)`After parsing this I should be able to know what functions contains what parameters.
[Code]...
I'm stuck with .Net Framework 2.0, so no Linq or lambda expression goodies for me. Also I want to include the code in my custom library and not just reference it. Can anyone point me to some good library or code.
I just need to parse and not evaluate the expression and find what tokens are in use. After finding the tokens I need to change the expression string before parsing, like if the function ORGVAL is used then the parameter passed has has to be prefixed by an underscore. Like ORGVAL(BAS) will transform to ORGVAL(_BAS). Some functions can have tow parameters like ORGVAL(BAS, "2012/12/31") and this will transform to ORGVAL(_BAS, "2012/12/31")
NOTE: IF THERE ARE OTHER WAYS OF DOING IT PLEASE LET ME KNOW. I WOULD LOVE TO AVOID A PARSER AND LEXER.
explain what is the difference between IsDbnull() method and convert.isDbNull(). Can you explain how do we implement both these methods with the of examples
View 1 RepliesI'm still relatively new to parsing xml documents into SQL. I am trying to parse one node out of an xml document.[code]...
View 12 RepliesWhat's the easiest way in VB.NET to parse this XML? Here's an example of the full source:View Source XML I believe that the XML can be read directly into a class structure that matches the XML's structure.Let's take a bit of the XML from the above example,
<?xml version="1.0" encoding="UTF-8" ?>
- <kml xmlns="http://earth.google.com/kml/2.0">
- <Response>
[code]....
How do I handle nested collections, for example, the Placemark collection in this example?
I have an app that the user selects information and it writes to an XML file. The user can increase and decrease the information in the XML file so it is dynamic. The other app reads the xml file and uses it to complete tasks. Since the XML is dynamic my code needs to account for that. Right now I have only allowed the XML to have up to four values in a certain node, I would like to allow more but I will need to increase the Select Case function.[code]
View 8 RepliesI am making a change to an existing process. Currently the csv file (which can have embedded "," with the field in quotes), is being passed to my module as a IO.StreamReader, pStreamReader.
[Code]...
parsing text that i have loaded in to my textbox Using ofd1 As New OpenFileDialog ofd1.InitialDirectory = "F:"
If ofd1.ShowDialog = DialogResult.OK Then RichTextBox2.Text = My.Computer.FileSystem.ReadAllText(ofd1.FileName)
End If
End Using
create a function that parses the input "4+7-4/4*4=" from instr into an array named tokens(1000), as string, and returns the number of arrays, or perhaps a negative number if there is an error in the input.
Dim tokens(1000) As String
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
[code].....
I have XML data like this:[code]I would like to return the name of the places. How may I extract this data using Visual Basic?
View 3 RepliesI may be getting in way over my head, but here it goes. I am developing a small application for use on a helpdesk. The application will be installed on the client pc's and will be used primarily by the end user to assist the technician on the phone if the user's pc is offline or inaccessible. One part of the application gives the user their IP address, DNS address, DHCP address, and gateway address. I have it to where it will put all of those in the corresponding fields inside a form, but it does not work correctly outside of a domain. Outside of a domain it only gives the IP address. I am sure it is probably how I coded it, but I cannot think of any other way to get that info in a user friendly way. Is there a way to parse a command prompt command to specific fields inside of a form such as the command ipconfig /all?
View 3 RepliesI am making a change to an existing process. Currently the csv file (which can have embedded "," with the field in quotes), i being passed as an
IO.StreamReader parameter pStreamReader.
dim vLine as string = pStreamReader.ReadLine
dim vFields () as String = vLine.Split(","c)
Well ... obviously the split does not work with embedded commas in a field. Looked at TextFieldParser, but it is in the FileIO class and the module is passed a IO.StreamReader. Can it work?
Or how abour a RegEx? Does anyone have any suggestions? I have look around on the internet and it seems like a common questions with a bunch of wild goose chases.
I am making a change to an existing process. Currently the csv file (which can have embedded "," with the field in quotes), i being passed as an IO.StreamReader, pStreamReader to my module.
The code reads ....
dim vLine as string = pStreamReader.ReadLine
dim vFields () as String = vLine.Split(","c)
Well ... obviously the split does not work with embedded commas in a field. Looked at TextFieldParser, but it is in the FileIO class and the module is passed a IO.StreamReader.
Or how abour a RegEx? I have look around on the internet and it seems like a common questions with a bunch of wild goose chases.
Here is a snippet of an XML file that I need to read with VB.NET[code]...
I am familiar with creating a new XmlDocument and using the Load method to read the file. I know how to get a collection of child nodes and loop through them to get elements and attributes. But in this case, I need to extract all of the data between the two "verse" tags (the starting one with the "sID" attribute and the ending one with the "eID" attribute), including the tags and the data in between as one continuous string. I can loop on the nodes, but I only get the "w" nodes and one final "#text" node for the period, but I don't know how to get the spaces and punctuation between the "w" tags.
I have a comma delimited text file with the U.S. States and their respective state bird listed in the following format.
"ALABAMA", "YELLOWHAMMER"
"ARKANSAS","...
"...
What im trying to do is parse the rows and send the parsed data to different comboboxes. I have a combobox for states and one for birds.I can load the file into the first combo box but im not sure how to parse and send the second column to the second combobox. here is what i have so far.
[Code]...
How can I actually send a string or another variable on the run to another running .net app? I searched google and found nothing really,
View 3 RepliesI have a text file that is in a comma separated format, delimited by " on most fields. I am trying to get that into something I can enumerate through (Generic Collection, for example). I don't have control over how the file is output nor the character it uses for the delimiter.
[Code]...
how to convert rss feeds to datagrid in this fomat
<Row>
<Cell><Data ss:Type="String">Symbol</Data></Cell>
<Cell><Data ss:Type="String">Close</Data></Cell>
<Cell><Data ss:Type="String">Prev</Data></Cell>
[code]....
the values in the first <row> </row> of data are the column headings for the corresponding cells in the other <row> </row>considering that I can work with xml in the other format this is quite strange so any help will be needed.
I am using mysql and I have installed the connector... here is a sample of my code. so far I can sucessfully connect to the db, but i am trying to learn how to parse sql commands to the db. for example in this snippet, i wanted to add to the testing table, an entry consisting of Fname and Lname.... It is not working... what should i be doing different ??
Imports
MySql.Data.MySqlClient
Imports
[Code].......
how to read and write xml, could someone possible provide sample xml and code to parse it so I can understand it more? Is it possible to parse the xml from a textbox?
View 1 RepliesI have a function that excepts a Message from MSMQ, I convert the body of the message into a string which represents an XML document. I need to parse through the XML document, grab the values from the nodes and process them. I am having problems using either XDocument of the XMLReader, both of them give me the error "Illegal characters in file". Here is a copy of the XML file as it is deserialized from the message:
<?xml version="1.0"?> <queueOrder xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <InterfaceName>EPN</InterfaceName> <Ingot>U06506L</Ingot>
[Code].....
I am fairly new to vb.net, but have quite some experience with Delphi, and did some VBA. Oh, I'm old school. I like DOS.
So, I need to write a program, and chose vb.net (visual studio 2008) as my language to do this in.
What the program is supposed to do is generate a webpage hit (but not necessarily render the html in a browser) and then parge through the returned HTML code, finding links, certain key words etc.
I'm trying to parse data from the web, basically, from an API rl...How do I approach this? Could I use XMLDocument to do this or MSXML2? [code]I've only worked where the node root doesn't have the name of the thing I need. So, how would I specifically retrieve the data for the node symbol? [code]
View 2 RepliesI have this following XML File. I would like to get the values of first Hsp_qseq, Hsp_hseq and Hsp_midline under tag HSP in VB.NET from the file out.xml
<?xml version="1.0"?>
<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd">
<BlastOutput>
[code].....
How can I parse XML that I don't have a file for?
I get the (dynamic) XML from an HTTP request, but all the XML classes I looked don't seem to be able to accept a string variable rather than a file.
I tried using XPath like this, but it just hangs.
Code:
Dim document as XPathDocument = new XPathDocument("http://www.myurl.com")