|
Thanks for the reply.
Will checkout Data Binding.
|
|
|
|
|
help with error providers for
telephone numbers
|
|
|
|
|
If you mean check a string for a valid telephone number format then I would use a regular expression.
|
|
|
|
|
|
I want to transfer the data displayed in listbox to a table and assign an IdNumber to each data transfer. And then to retrieve that data from that table for the relevant Id and after more additions to that data in list box, transfer again to table and save it permanently. I am using MsAccess as database. i have following data in list box in vb express 2008:
Description Quantity Price Amount
Order1 2 3 6
Order2 3 4 12
Order3 2 3 6
Order4 4 2 8
Total 32
So how i can transfer this data to a table giving it one Id and then retrieve that data in listbox from that table using the same id and after addition of more two Orders( Order5 and Order6) in the list box, transfer it back to that table for permanent save.
Kindly advise me the code for this requirement.
|
|
|
|
|
Do you know how to either insert or update a record in Access, from Visual Basic?
If you did know, the solution should be obvious.
Now this is such a common requirement that lots and lots of people have done it before. Lots of those have written about how to do it, including some people at Microsoft.
So why not start out by Googling for Insert Access Record VB, or something similar.
When you have tried, if you get stuck, ask again with some sample code and fully describe the error you are getting.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim total As Integer
total = txtQuantity.Text * txtPrice.Text
txtAmount.Text = total
If ListBox1.Items.Count <> 0 Then
ListBox1.Items.RemoveAt(ListBox1.Items.Count - 1)
End If
ListBox1.Items.Add(txtId.Text + vbTab + txtDescription.Text + vbTab + txtQuantity.Text + vbTab + txtPrice.Text + vbTab + txtAmount.Text)
total = total + Integer.Parse(txtAmount.Text)
ListBox1.Items.Add("Total " + vbTab + vbTab + vbTab + total.ToString())
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListBox1.Items.Add("Id " + vbTab + "Description " + vbTab + "Quantity " + vbTab + "Price " + vbTab + "Amount ")
End Sub
Private Sub btnTransData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTransData.Click
Dim desc, qnty, price, amount As String
Dim Cmd As OleDb.OleDbCommand
Dim SQL As String
Dim objCmd As New OleDb.OleDbCommand
Dim Con = New OleDb.OleDbConnection ""Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Propriet rio\Desktop\bd2.mdb")
Dim id As Integer = 0
Con.Open()
For Each item As String In ListBox1.Items
If id <> 0 Then
Dim parts() As String = item.Split(" ")
SQL = "INSERT INTO TestTable (*) VALUES ('" & id.ToString & "', '" & parts(0) & "', " & parts(1) & ", '" & parts(2) & "', '" & parts(3) & "')"
Cmd = New OleDb.OleDbCommand(SQL, Con)
objCmd = New OleDb.OleDbCommand(SQL, Con)
objCmd.ExecuteNonQuery()
End If
id = id + 1
Next
Con.Close()
End Sub
it is giving the error ""IndexOutOfRangeExecption was unhandled""
kindly advise the correction.
|
|
|
|
|
Do you not know how to use a debugger ?
I would try to help, but I'm not going to read all this code to try to work out what line is giving the error.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I thinky your SQL INSERT statement could use some work. First, I don't think it's a good idea to put that asterisk in there. Second, convert this so it uses a parameterized query instead of building an SQL statement using string concatenation.
|
|
|
|
|
Hi,
I am using Winsock control in Visual Basic 6.0. I am writing a application to chat with local network users. So on form load it has to get all ip addresses or machine names connected to my system.
Please help me out.
Ramesh Sambari
Knowledge is like honey.
Collect it, to make life sweet.
|
|
|
|
|
specialdreamsin wrote: So on form load it has to get all ip addresses or machine names connected to my system.
Why?? What's it going to do with those addresses??
This is a chat application. All it needs to know is the IP address of a central chat server, or the server exposed by another copy of your application running on another system.
|
|
|
|
|
Unless he wants to connect directly to the client, without using a central server
Motivation is the key to software development.
|
|
|
|
|
What's he going to do?? Port scan every machine in the network looking for clients??
It's possible to do with advertising broadcasts, so long as they're not being blocked at the routers/switches. But, this is not trivial to implement.
|
|
|
|
|
Indeed, too many "ifs". Your solution is probably the best one in this situation. One central server which distributes chatting traffic to the other clients, preferably using UDP instead of TCP, since the computers are directly connected through LAN. But since he's not responding to your message, I think he found a solution. Always nice to know people respect your help, isn't it
Motivation is the key to software development.
|
|
|
|
|
Zaegra wrote: Always nice to know people respect your help, isn't it
That's par around here. Very rarely do you get any response to anything if you have to ask the OP for additional information or even to say if the solution worked.
|
|
|
|
|
Hi all,
I am very much thankful to all of you for your reponse. But I am extremely sorry that It doesn't suite my requirement.
What exactly I want is, I want to list out all the System Names connected to my system in the LAN only. Like My Network Places link on Desktop will show all systems in Windows.
Ramesh Sambari
Knowledge is like honey.
Collect it, to make life sweet.
modified on Friday, May 15, 2009 2:00 AM
|
|
|
|
|
First of all, that makes your question a lot more specific.
To (partially) answer your question:
You can check when someone connects to your system. When it does (and you accept the connection), you have a socket adress. Now: You'll have to write a function that returns the computer name (on the client side), and sends it to your system using winsock. So immediately when the connection succeeds, the client sends his name to your pc.
There is also another option, but I don't exactly know how to use it. Try searching for GetHostByIP() and GetHostByName(). As I said, I only know these functions exists, not how to use them, but it won't be so hard to figure out I guess
Cheers,
Zaegra
Motivation is the key to software development.
|
|
|
|
|
You can scan the network for machines connected to the same network, but this is a very time consuming process.
"Connected to your system" doesn't really mean anything because the only thing that would normally be "connected to your system" would be servers doing inventories, checking for updates, and intalling software and updates.
|
|
|
|
|
Hi everyone,
I'm new to VB2008 and I would like to use the old DBCombo from VB6.
Can someone tell/teach me how?
I've already tried using the ComboBox, but what I would like to do is somewhat like the function of the DBCombo.
I mean, select from the list (listfield) and return the other (boundcolumn).
Any ideas?
Thanks in advance!
|
|
|
|
|
Rene Samuel wrote: select from the list (listfield) and return the other (boundcolumn).
That's exactly what the ComboBox does if you bind a datasource to it.
|
|
|
|
|
You're right. I finally got it.
|
|
|
|
|
Hello David,
modified 28-Nov-12 4:21am.
|
|
|
|
|
If you had posted this to the original thread, we would all have a better understanding of the original problem. As it is your post is meaningless except maybe to David assuming he can remember what your original problem was and his suggested solution.
As David is a prolific poster, chances are he would remember the full details.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
dear all
i have read something in internet how to call c++ .dll, and tried to declare functions in vb 6, but however after i compiled, the error was there:" can't find DLL entry point in xxxx.dll". so how to invoke the c++ member function in one .dll, someone can give me help to realize step by step. thanks a lot in advance.
note: probably one library has several classes, so how can i know which library i can use or how to use it?
rgds
|
|
|
|
|
There are different types of .DLL files. If it's a COM-based .DLL, you can add a reference to it, then instantiate the classes in it using Dim:
Dim x As New SomeClassInLibrary
If it's a library .DLL, then you have to use the Declare statement to setup the call. But, in order to use this, you MUST have the documentation on the functions you want to use so you can properly write the parameter information into the Declare. Without it, you're guessing and are going to get it wrong.
|
|
|
|