How To Join Queue (Of String) As A String
Sep 26, 2011I have following code:Dim PendingFiles As New Queue(Of String)I need to join each element of PendingFiles with a comma and store the result as a string. How do I achieve it?[code]
View 1 RepliesI have following code:Dim PendingFiles As New Queue(Of String)I need to join each element of PendingFiles with a comma and store the result as a string. How do I achieve it?[code]
View 1 RepliesI want to put all elements of a String array into a Queue(Of String). I have following code which using For...Each to put string into Queue(Of String):
Dim Files() As String = OpenFileDialog1.FileNames
'OpenFileDialog1 is an instance of OpenFileDialog control
Dim PendingFiles As New Queue(Of String)
[code]....
Is that possible to do it (i.e. put string array into Queue(Of String)) without using For...Each?
I have a string which I've split into an array. I need to change a value in the array and join the string together. However I cannot set the value of the array variable as it's read only.Is there any way to do this without creating another array?
Dim LineOfText As StringDim aryTextFile As String[code...]
I'm trying to improve performance of an application by introducing threading (see my earlier question). I have filled a Queue(of String) with XML messages and I now want to setup two threads to post these messages to a webserver). This process needs to ensure that each message is only posted once. Would a BackgroundWorker (or two) be suitable for this?
View 2 RepliesConsider the below code (which dynamically creates a dynamic SQL string) Is there a way to further compact string.join, so it does replace("'","''") on all array members automagically ? (without writing a custom version)
[Code]...
Is there a way to use [string].Join to concatenate html stings including spaces? I want to join html strings with a special character so I can pass them as an array to javascript from the code behind.
Dim Array(100)
As
String
ArrayString = [String].Join(",", Array)
This works great if each item in Array is one word only, but what if each item in Array contains spaces?
I 've an ArrayList and to join all its elements with a separator in one string I m using...
Dim s As String = String.Join(",", TryCast(myArrayList.ToArray(GetType(String)), String()))
however, I would know if there is a smarter/shorter method to get the same result,or same code that looks better...
[Code]...
What am I doing wrong or do I use a incorrect way to extract text from an array? Using += takes up a lot of computing power when it reaches like 50000 characters so I want a method with much better performance
Can I do anything more or less with IDictionary? How do these two collections differ?
View 5 Repliesmy code is :
[Code]...
The error is Value of type '1-dimensional array of string' cannot be converted to 'String'.
I want the Function to accept List(Of String), Array & String and similarly return List(Of String), Array & String respectively. The Function simply adds a string (month) to the input collection. I just want to use it for string, array and list with needing to think of conversions.
[Code]...
Basically I have a webresponse stream:dim lol as string = readstream.tostring there is a lot of information within the string but only one link starting with http: located near the end of the string - however there is no constant character point where I can start... (i.e. 38)
I want to extract the link from the string i.e. dog cat plane car [URL]..that is approximately how it looks above - words and url substituted I want to just extract [URL]..I had an idea of parsing the string from http: to the end Then after that splitting the string up again to remove the }], however it does not return anything
I got an app, which receives data via a R232 port, convert it to a string and on the other side I got a database, where the strings are saved. How can I find a way to compare the string with all strings in one database column and get back the another stringform the same row in this database. I never programmed a database
View 1 RepliesI have buttons generated through code (dynamically). I have to associate an event (the same) to them. I use AddHandler button.click, AddressOf mysub.The issue is that mysub gets a string (mysub(string)), but AddressOf doesn't accept a parameter inside the routine. How can I do this? Using also an alternative to AddressOf.
EDIT:
Public Class Form1
...
Private Sub mysub(ByVal sender As Object, ByVal e As System.EventArgs, ByVal str As String)[code]......
These is the content of my txt file which is saved in D drive in my pc abc,1,2,3..I tried the flowing but it didn't work:[code]I am getting error on this line.. data = line.Split(","c)...it says this line isn't in use anymore or something and that I rather use LineInput but thats asks for filenumber and i don't know what that is. I am sorry but I am a complete beginner. what else can I try? [code]ok that error is gone now but now if I want to add these values to a list box..how can i do that?
View 1 RepliesWhat is the best way to pass the four (4) parameters after the applicationName to the application to be launched?
Process.Start ("C:\MyApp.exe",
"CommChannel1",
"DeviceName",
"Language",
"UserName")
Iwant to join two tables,'Employee' and 'Dispatch'. Dispatch has column 'DispatcherID' and 'TechnicianID' which are both foregn keys to EmployeeID in Employee table.I want to join these two tables using EmployeeID so that i can obtain the matching name to each id.but it only works when i make a single join to either DispatcherID or TechnicianID and not for both.
[code]
select Employee.firstname+' '+Employee,secondname as Technician,Employee.firstname+' '+Employee.secondname as Dispatcher from Dispatch inner join Employee on Dispatch.TechnicianID=Employee.EmployeeID inner join Employee on
[CODE]...
I have the following web method:
<WebMethod()> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHttpGet:=True, XmlSerializeString:=True)> _
[Code].....
I wanted to use HttpGet here so that the result can be cached.
I tried every variation of calling this, but no luck. Is this possible with GET?
I have a field that I display via: String.Format({0:c},amount) This produces the string "$28.28" However, when I try to convert back to a decimal amount, I get an incorrect format exception: amount = Decimal.Parse(amount.Text, NumberStyles.Currency) I also tried it with NumberStyles.AllowCurrencySymbol with the same results. I verified that the value in amount.Text is "$28.28". Am I missing something? Shouldn't these two operations use the same currency symbol and formats?
View 2 RepliesI Ported this code from a code project article in c# called Nscript
heres the code
Base App
Imports System
Imports System.IO
Imports System.Resources
[code]....
Okay Now I only get two errors (I dont know how to solve them)
Error3Class 'BaseApp' must implement 'Sub OnCompilerError(errors() As CompilerError)' for interface 'IScriptManagerCallback'.
And
Error4Class 'ScriptManager' must implement 'Sub CompileAndExecuteFile(file As String, args() As String, callback As IScriptManagerCallback)' for interface 'IScriptManager'.
But What I would also Like to know (as well as how to fix the errors), is would the code work?
I need a regular expression that can validate that a string is an alphanumeric comma delimited string.
Examples:
123, 4A67, GGG, 767 would be valid.
12333, 78787&*, GH778 would be invalid
fghkjhfdg8797< would be invalid
This is what I have so far, but isn't quite right: ^(?=.*[a-zA-Z0-9][,]).*$
Problem: Your task is to take input from the user in string and give the following options to the user in a menu.
1- Find a String
2- Create sub-string
3- Erase a portion of a sting
4- Replace a word in the string
5- Count number of words and characters in the string without spaces.
6- Capitalize first character of each new sentence and convert the rest
of the characters to lower case.
7- Sort all the words in alphabetical order. (Use Bubble sort algorithm to perform sorting).
To perform all the above mentioned tasks you can only use pointers. Create a function to perform every task.
So strings are reference types right? My understanding is a reference to the string in the heap is passed even when you pass the string ByVal to a method.
String myTestValue = "NotModified";
TestMethod(myTestValue);
System.Diagnostics.Debug.Write(myTestValue); /* myTestValue = "NotModified" WTF? *[code].....
And what is going on under the hood? I would have bet my life that the value would have changed....
Im working on a program and I get this "Value of type '1-dimensional array of String' cannot be converted to 'String'." heres the code that gets this error:
[Code]...
I don't understand why the line final.join etc pops up with these errors!! Value of type 'String' cannot be converted to '1-dimensional array of String' And Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated This is my code.
[Code]...
when i transfer the bytes sent by the client program to a string the string length is affected.when i put the bytes sent by the client program to a message box. it returns the corrrect text. but when i check the length it will return 8192 or higher. but the actual size is just 5.
My Code
Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient()
RichTextBox1.Text = RichTextBox1.Text & vbNewLine & "Connection accepted."
' Get the stream[code]....
The following is ment to generate the path to a text file and stream the data found there into an array.
Dim y1 As String
Dim y2 As String
Dim y3 As String
[code].....
I'm trying to code a program but this error repeatedly shows up and I can't for the life of me figure it out EValue of type 'String' cannot be converted to 'System.Windows.Forms.TextBox'. It appears in relation to this code
[Code]...
I need to do this to every line in a file and save the # five Element in an array. I keep getting (error code 1 Value of type '1-dimensional array of String' cannot be converted to 'String'.)
NOTE: if I change ( Dim Lineoftext(1) to Dim Lineoftextt works) (It does't seem to work with arrays)
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
[CODE]....
What I need is to be able to put in a SortedList a combination of two fields that are non-unique, but the pair is (like database composite keys).More precisly, i have my list, and i want to be able to do this with it
Dim myList = New Generic.SortedList(Of String, String)
myList.add("aaa","aaa")
myList.add("aaa","bbb")
[code].....