|
True, didn't say it was easy just possible
|
|
|
|
|
Nothing is ever easy, is it??
|
|
|
|
|
hi
modified 28-Nov-12 8:52am.
|
|
|
|
|
vijay2482 wrote:
If m <> -1 Then
If m = -1 Then
there you have your problem. You got m <> -1 and m = -1 . Well only one of them is true. Don't you think so?
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
m = name.IndexOf("Groupe")
If m <> -1 Then
sw.WriteLine(LTrim(name))
End If
this is right...
but even then i dont get the output
|
|
|
|
|
So what are you expecting LTrim to return?? It removes all whitespace characters from the left end of a String, like Tab and Space. If there are character values higher than these than don't have a glyph image, or has just a box image, those characters will not get removed.
You'll have to explain what you mean by "doesn't work".
|
|
|
|
|
i want to shift the line left by 2 characters
|
|
|
|
|
No kidding, you already said that.
What I asked you is, do you know what LTrim does?? How is it suppoed to know you want to move the characters to the left, by 2 places, since you didn't specify anything like that in any of your code?
|
|
|
|
|
vijay2482 wrote: f the index "Groupe" is found in name,i want to write the line altering the name by shifting it left by 2 places...
To me it sounds like you need to do a mid (getting a section of a string) vs instead of a LTRIM (trimming spaces).
vijay2482 wrote: If m = -1 Then
Agreed w/ above poster - that's whack.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Hi all
Quick question, how do I format a number, say 34 to 034, just for better presentation? (I'm currently using String.Format("{0}", newPartNumber) )
Thanks
|
|
|
|
|
|
Use tostring Function to Convert string Format. .Tostring("Formatofdata")
Val1= 1
Str1 = Val1.ToString("000")
//Value of Str1is 001
Best Regard
Anubhava Dimri
mailto: anubhava.prodata@gmail.com
|
|
|
|
|
here is my code
<dim openfiledialog="" as="" new="" mode="hold"> Dim filetoread As String
OpenFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
OpenFileDialog.ShowDialog()
filetoread = OpenFileDialog.FileName
Dim filestream As StreamReader
filestream = File.OpenText(filetoread)
Dim readcontents As String
readcontents = filestream.ReadLine
Do While Not filestream.EndOfStream
readcontents = filestream.ReadLine
Loop
Dim textdelimiter As String
textdelimiter = ","
Dim splitout = Split(readcontents, textdelimiter)
txtt24import.Text &= readcontents
filestream.Close()
Dim sql As String = ""
If txtt24import.Text.ToString = "" Then
End
End If >
|
|
|
|
|
So where are you stuck?
What is happening and what should be happening?
Any error?
From what I can see you read all the lines off a text file line per line (you could simply use the method 'readtoend' for that) and each time overwrite your variable 'readcontents' so you actually only have the last line in the file.
|
|
|
|
|
Hi there,
No there are no errors the problem is that i dont want to use the method 'readtoend'
this is the format of the textfile
123213,john,Smith,Stanchart,xxxxx,2000,27/03/2009
123213,john,Smith,Stanchart,xxxxx,2000,27/03/2009
123213,john,Smith,Stanchart,xxxxx,2000,27/03/2009
123213,john,Smith,Stanchart,xxxxx,2000,27/03/2009
i want to read each line and insert them into a table in the db. The table is in the same format but when i 'readtoend' i will have a problem inserting the values..
Can you also assist on how to read from a path and not reading the contents into the file textbox.
Thanks in advance.
|
|
|
|
|
Following the question above,
I think I know how to add it to a combobox or a datagrid, but I have no idea how to get it to run as a queue. Any ideas on this? Much help is aprreciated
Quin
|
|
|
|
|
Simple - you don't. A combobox was designed to show a list of display values, not maintain a queue. If you really need a queue, there's a Queue collection in the System.Collections and System.Collections.Generic namespaces.
The only problem is that you can't bind the combobox to the queue. You can, however, create an array that IS bindable by calling the queue's ToArray method and binding the combo to the resulting array.
Another alternative is to create your own custom collection that uses a queue internally, but also exposes itself as bindable by implementing the IList interface[^]. (Sorry, IBindingList won't work with the ComboBox)
modified on Wednesday, March 25, 2009 12:18 PM
|
|
|
|
|
Thanks for the fast reply. Then is it possible to bind data selection from the combobox and put it into a queue list? But I want to display this queue list, should I use datagrid view or something else?
|
|
|
|
|
You can bind a different list to the combo, or just add each item individually. As for the queue, you just handle the selection changed event of the combo and add the item to the queue as required.
|
|
|
|
|
Alright, I have added it to the queue list and now I want to send it out as a string but the queue item is object type. I tried looking up at the function Ctype to convert it but it keeps giving me errors with this message "Conversion from type 'String()' to type 'String' is not valid." What am I doing wrong?
Private Sub RunTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RunTest.Click
Dim datatry As Object
datatry = tasklist.Dequeue
DataSend = datatry
'serialPort.Write(DataSend)
ListBox1.Items.RemoveAt(0)
End Sub
|
|
|
|
|
It's trying to tell you that you added a String array as a single element to the queue.
|
|
|
|
|
Then how should I write it? I'm not too sure how it goes. It's just this error stopping me from writing to the serial port. I tried adding to .ToString at the end but It just gives me an empty string
|
|
|
|
|
Finally got it down to rewriting the whole process of adding to queue. Seems like I did not join the individual arrays before adding them to the queue. Once I joined the arrays together and add it to queue as a single element, it can display the string as it should. Thanks for all the help.
|
|
|
|
|
VS 2008 Team edition SP1 can only read .vbs files, however can not give any indication on the errand code or running it, so anyone can help on sharing an insight on the VS solution to that problem, or suggest a freeware "reliable" editor that can help. Thnx
|
|
|
|
|
I suspect you have not installed it fully, I use it all the time to do C# and VB
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|