Adding Strings In .net?
Aug 19, 2009
I have a function where I have to add two values (declared as string) on two different pages, So Iam bringing one value from one page to the second page where I have second value and adding both of them to display the result in a label. But I am not able to do that. eg: 1st value is 4.20 ( both values are time in seconds) and 2nd value is 0.34 then I want the result as 4.54( instead I am gettign the result as 4.24.0.34 , So can anyone tell me how to add these two ..My code is attached.
Dim L1 As String
L1 = main.TimeElapse(Value1).ToString
'Label1.Text value is the below line
Status.ShowSuccess("Ready: Result is " + _Myfunction.GetTimeInSeconds.ToString("N1") + TimeElapse(value1).GetTimeInSeconds.ToString("N2") + " seconds")
View 4 Replies
ADVERTISEMENT
Jun 15, 2011
I am working on a program where specific strings are being read from a file and displayed in a listview. Some of the strings represent money values though the file has no decimal points. I would like to add a decimal point before the last 2 digits of prices, quantities, and freights when displayed in the listview (not add two decimal places but actually insert the decimal point into the string). I would like to be able to keep most of the code I already have though, and I have no clue how to accomplish this. Here is the code I am using to fill the listview:
VB2010
Public Class Form1
Dim dates1() As String[code].......
View 6 Replies
Nov 8, 2009
label1.text = "<a href='#' onclick="window.open('PageTwo.aspx','',''); return false;">Click here</a>"
Notice the 2 quotes in bold above. I need to add (return false) so the browser won't scroll to the top of the page when the text label (#) is not found.
View 1 Replies
Dec 15, 2010
before you see any of this, you will have made a text file (dont ask how)
the text file will contain html with an unknown number of lines
(the user will click a button to add a new line to the file, so the number of lines depends on the user
each line will look like this:<a href="www.link.com"> text </a>[URL].. is just a place taker for what the user would have written there as well as "text"
[Code]...
View 6 Replies
Aug 23, 2009
I have my app that does some complicated function and adds some values to an array, but then later I need to access the strings, I have the index number but not the string so how can I find that string again?
View 2 Replies
Jan 6, 2012
I can retreive all items in my notepad but when I am adding them up in my listbox, and trying to print them in the console. I can only display two strings. I don't know why. My string is a combination of a name, space & score. ex: "luke 300". That is the pattern of all strings per line in my text file. I am separating the name and the score using space as the indicator. When ever a space is found, string before and after the space is retrieved and added to the listbox
Here is my
scorelist = New ArrayList
reader1 = My.Computer.FileSystem.OpenTextFileReader(My.Application.Info.DirectoryPath & "scores.txt")
[Code].....
View 2 Replies
Oct 16, 2009
Say I have a List(Of Tag) with Tag being an object. One member of Tag, Tag.Description, is a string, and I want to make a comma-separated concatenation of the Description members.Is there an easier way to do this than to read the Description members into a List(Of String) and then use the Join function?
View 2 Replies
Apr 4, 2010
I have a statement. I need it to say something. I tried this:
[Code]...
View 1 Replies
Jun 7, 2011
I have string which is:
document1.txtdocument2.txtdocument3.txt
What I would like to do is split it so it shows in a listbox as
document1.txt
document2.txt
document3.txt
I have come up with a solution which may work. Its preety over complicated too me but this is the only way I could think of?
What I need help on is a code so that after every ".txt" it will place a "/" so the string will look like this:
document1.txt/document2.txt/document3.txt/
Then I would use this code to split the string:
Dim I3() As String
I3 = I.Split("/")
For g = 0 To I3.Length - 1
ListBox1.Items.Add(I3(g))
Next
View 6 Replies
Aug 13, 2009
I am working on a UDP Client/Server, and currently i have them sending back and forth strings, which i convert to bytes, and then open the bytes to read. I want to now send an Object instead of those strings, which includes multiple unsigned integers and strings.
View 39 Replies
Aug 5, 2010
I have a list of strings. For each string in that list, I want to prepend another string. I wrote a method to do it, but I was wondering if there was something already in .NET I could use to do this. It seems like something that could be built in, but I was not able to find anything.
Here is the method I wrote:
Private Function PrependToAllInList(ByRef inputList As List(Of String), ByRef prependString As String) As List(Of String)
Dim returnList As List(Of String) = New List(Of String)
For Each inputString As String In inputList
returnList.Add(String.Format("{0}{1}", prependString, inputString))
[code].....
It works, but I would rather use built in functions whenever possible.
View 5 Replies
Oct 16, 2009
I'm migrating from VB6 to VB.NET, in hence my questions below:
I have to write a function that returns array of strings.
How can I initiate it to empty array? I need it since I have to check if it's empty array after it returns from this function.
Is list of arrays better for this purpose? If I use a list - Is it empty when it firstly defined? How can I check it it's empty?
View 3 Replies
Aug 15, 2011
I have been looking for examples to find the string between two strings. This top one works fine;
Public Sub ReadData(ByRef keywordStart As String, ByRef keywordEnd As String, ByVal filename As String)
Using reader = New StreamReader(filename)
[Code].....
Now the first one is fine - Ext_Volume is result of the string between the strings <Volume> and </Volume>. <Volume> and </Volume> are unique so this is straight forward.
However the second one - "^FDExp:" is unique, but "^FS" is not unique. There are occurances of "^FS" before and after "^FDExp:".
How do I get the string to search AFTER the occurrence, not before etc?
View 5 Replies
Jun 24, 2011
Dim str As String
Dim str2 As Array
str = "blabla duhduh"
str2 = str.Split(" ")
View 2 Replies
Apr 6, 2012
Say the string is something like
bla bla bla bla (cat) bladfdskdfd dsgdsdksf (dog)
dfdshfdskdskfsdfkhsdf sdkfhdsfkdf (kathy) fdsfhdskfhdsfkd (doggy)
I want a generic.list (of string) containing
cat
dog
kathy
doggy
How to do that with regular expression in vb.net
Later I want to do something more complicated like getting all strings between "url":" and ", from this strings
[Code].....
View 1 Replies
Jan 8, 2012
Is there an easy way to find a certain string within a string and then return the strings that you find as an array?I have written this:
Public Function FindStrings(ByVal strSourceString As String, ByVal strStartString As String, ByVal strEndString As String) As String()
Dim StringStartposition As Integer
Dim StringEndPosition As Integer
Dim Currentposition As Integer = 1
[Code]...
View 16 Replies
Jan 16, 2011
I have this string called time. It's value is in this format: HH:MM:SS The numbers change, but the format stays the same. I want to separtate the code into 3 strings Hour, Minutes, Seconds.
View 2 Replies
May 14, 2009
I have a DataGridView that has some columns with dates. It binds to an in-memory Datatable which gets loaded from an string array of data passed back from the backend Some of the rows returned have nulls for the date columns. Solution 1: If I define the Date column in the DataTable as "string" I can easily convert those nulls to empty strings and display it in the grid as empty strings (desired results). However, if the user clicks on the date column header to sort by date, it doesn't order the rows as you want. You get a purely string sort order. Not acceptable
[Code]...
View 2 Replies
Jun 7, 2011
I am trying to create a simple Word doc that when the user presses the button it takes the information in the boxes and tosses it into a template style paragraph. But my issue is that I have two combo list boxes as seen in the picture. I want to have two values in the drop down list as seen in the labels next to them but for the life of me I can't figure out how to do this in Word 2007. In Visual Studio this is much easier but I am work and need to snap this out for the folks at work. Is there an option that I can choose in the properties where I type in the values for each drop down or do I have to add them in at run time?
View 1 Replies
May 4, 2012
I'm adding labels at runtime to my form with a tag. Let's say I have 3 labels with the tags, "1", "2" and "3". I'm adding the tags by counting the labels + 1. When I remove a label with tag "2" from the form there are only 2 left. When I add a new label it will add a new tag "3", but that one already exist. So my "solution" isn't a very good one Although tag "2" is free, I want to give it "4". Any thoughts on how to code this properly?
View 2 Replies
May 17, 2010
Here's the weird problem I am trying to solve but cannot get my mind around it. In a text box 1, the user enters 2 or more strings separated by comma. then in text box 2, the user enter 1 or more strings separated by comma. The output then puts the strings from text box 2 between the strings in text box 1
Example:
TextBox1 = visual basic, java, perl
TextBox2 = is better, compared to
[Code]...
View 1 Replies
Aug 14, 2009
I have a text box where i have time stored in it and i have another text box with the time as well. these text box have stored time as "string" . now i want to add times but gets an error message(ex on monday the emp works 2 hrs and tuesday 5 hrs and i want to display 7 hrs in total hrs worked for the week)[code]
View 5 Replies
Jul 14, 2011
I used to add 2 strings variables and it works but when I tried using VB2008 it didn't work. [code]
View 9 Replies
May 2, 2010
I need to add numbers in strings My program concatenate the numbers instead
Dim first As String
Dim complete1 As String
Dim complete As String
[Code]....
View 2 Replies
Aug 21, 2010
I am writing a program that uses an array with three columns and a varying amount of rows. I need to load info on a list of files in an archive(specifically: file name, size, path), and I am wondering what the most convenient way to store strings(to be loaded into the array) is.
For example: I tried creating a new .resx file in my project, and writing a function to be executed on form1_load that reads the strings from the .resx file and places them in the array in their correct column, but unfortunately had no success.
I really have no idea how resx files work, I can put strings in them using the resource editor, but I don't know how to retrieve them using resourcemanager.
I would just put the info straight into an array, but it's much easier to update a .resx file when the archive changes than it is to update the code.
Could someone please tell me how to use .resx files in vb.net? Or an easier way of accomplishing my goal?
View 7 Replies
Nov 26, 2009
I have a string that looks like this:
var expression = @"Args("token1") + Args("token2")";
I want to retrieve a collection of strings that are enclosed in Args("") in the expression.
How would I do this in C# or VB.NET?
View 4 Replies
Nov 27, 2009
When i try to put two string in a ListView1 i get this error.
Quote:
Error1Operator '&' is not defined for types 'System.Windows.Forms.ListViewItem' and System.Windows.Forms.ListViewItem'.C:UsersAdminDocumentsProForm1.vb5037FileFind
My code
Dim lvi As New ListViewItem(foundFile, 0)
Dim str(1) As String
Dim itm As ListViewItem
[Code]....
View 27 Replies
Jan 29, 2012
In Visual Studio 2010 for Windows Phone , every time I want to concatenate 2 strings , I get an error message:
[Code]....
View 4 Replies
Oct 22, 2010
I'm trying to create a number of strings based on one long string that i'm passing.
Basically this is an example of my long string
StrMain = AL123456 - PR123456 - RD123456 - LO123456
So in this case I want to create 4 separate strings.
Str1 = AL123456
Str2 = PR123456
Str3 = RD123456
Str4 = LO123456
But there isn't always that many or there may be more so I need to count how many - there are and with that then create the amount strings needed.
View 3 Replies
Mar 15, 2009
i need to be able to get the difference between two strings, i found out how to get the difference with this code:
Dim Changes As String = NewText.Replace(OldText, " ")
but i also need to be able to find the index of where the difference is, does anybody know how to do that ? EDIT:I just found a flaw in that code, if the OldText is "html" and the NewText is "html html" Changes is not gonna be "html"
View 9 Replies