|
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
|
|
|
|
|
so what went wrong during instaltion
|
|
|
|
|
Moe2009 wrote: so what went wrong during instaltion
Hard to say, without my telepathic-look-back-in-time-thingy, which is unfortunately broken at the moment and won't come back from the laboratory for another week.
|
|
|
|
|
I've just sent it off. It was broken by the attempted scanning of a very dense object. Try to keep it away from the question forums
|
|
|
|
|
How the hell I am supposed to know? Yo presumably did the intall, what options did you pick? Did it give any error messages?
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
want to Display Upper Case Letters in Text Box while Pressing Lower Case Letters, I tried with
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii >= 65 And KeyAscii <= 122 Then
Text1.Text = UCase(Text1.text)
End If
End Sub
but it is printing in reverse , is there any other mothods.
|
|
|
|
|
Hi
in the properties section of the text1 control you have an option called
CharacterCasing which is set to Normal by Default. Set this to upper so that when the user types in lower or upper it will display in UPPER Case.
thanks
|
|
|
|
|
hi guys
i am trying to download a file from the server by suplying the correct credentials but am getting a bad username or password error.
the command i am using is
My.Computer.Network.DownloadFile(My.Settings.ServerFile, My.Settings.LocalFile, "username", "password", True, 1000, True)
the username and password supplied is correct.
when i click on start-> run the ip address of the server, it pops up a username and password box. i enter in the exact same credentials and it goes through.
what could be wrong or is there a better way of getting the file from the server onto a local pc
thanks
anoop
|
|
|
|
|
I'm assuming you're talking about grabbing the file from a Windows server.
Try prefixing the domain to the username, "domainName\userName".
|
|
|
|
|
Hi,
thanks for your help,
i have tried that but still same outcome.
is there perhaps another way of doing this i.e. coying a file from the server and providing username and password?
thanks
|
|
|
|
|
Uhh...you already are doing this. You've got the correct method, the trick is to use the correct "domain\username" and "password". If you're downloading a file from a Windows server or workstation, you need to understand how Windows networking works.
If the server is in a domain environment, you need to use an account that the domain recognizes. If the server and workstation that you're code is running on are in different domains, then you need to specify the domain that the server will recognize, usually the same domain the server is in.
Now, there's a catch. If you're logging the workstation in under one account and making connections to the server, you cannot use a seperate account to download the file form the same server.
If the server is in a workgroup environment, then you may have to specify the name of the server as the domain part of the username.
|
|
|
|
|
Hi,
I am doing a project in VB.Net and backend as MySQL.. One of my Forms Contains a Treeview, a Textbox and 2 ComboBoxes. In the first ComboBox i have two predefined values named 'Group', and 'Account'. When i select the Type as 'Group' it should add as a Parent node to the TreeView. And these groups should be updated to the 2nd combo box.
When i select the Type as 'Group' i can be able to add a Child node under the particular Group selected from the 2nd ComboBox.
If the Type is selected as 'Account' it should be added as Child node or sub Child node to that Group.
Sample Flow:
-Group1
| |
| -Account1
| -Sub Group1
| |
| --Account2
-Group2
|
-Account3
Can anyone please help me?? Its very Urgent.
Thanks in Advance
VB.Net
modified on Thursday, March 26, 2009 1:28 AM
|
|
|
|
|
So...what's the question?? I'm assuming your just going to create a new TreeNode object an add it to the Nodes collection of the SelectedNode.
|
|
|
|
|
Hi,
So you got some idea on my requirements right. What i want is, i want to add a child or leaf nodes to the Treeview dynamically by selecting the nodes from the combo boxes.
I have written the code like this..
TreeView.Nodes.Add(cboUnder.SelectedItem).Nodes.Add(txtName.Text)
But using this i am getting the parent node repeatedly.
Please help me in solving the problem.
Thanks
Victoria
VB.Net
|
|
|
|