|
I would like to create a simple datagrid in VB.net. I have a dataset that I would like to make calculations and then JUST display to the datagrid, no input needed.
Thanks.
|
|
|
|
|
dkoco,
Me.grd.DataSource = ds '<-- dataset
me.grd.DataMember = "tablename" '<-- the table name within your dataset
'---------------------------
'if you don't know the table name you can do this also
me.grd.DataMember = ds.tables(0).tablename
'---------------------------
me.grd.Refresh() '<-- makes the grid load the data in automatically for you
hope this helps
nathan
|
|
|
|
|
Hi All,
I have developed an application which contains a listview control (with 3 columns). I am able to use the LVM_FINDITEM message to finding an item from the first column of the list view control. We need to use this message to find items from the other columns in the listview control.
Shall any one please help me how to find subitems in a listview control suing LVM_FINDITEM message.
Thanks in advance,
Pradeep
|
|
|
|
|
Does it absolutely have to use LVM_FINDITEM? There are other ways of getting information from a listview.
|
|
|
|
|
Hi,
Ive created a datagrid on a form, which is filled from a dataset and sqldatadapter object.
I want to be able to modify the data in the grid, and then click Save, to post changes back to the database.
However, the wizard hasnt created an Add/Modify/Delete command in the adapter, only a select, which is something along the lines of:
SELECT ID, FirstName, LastName, address FROM Customers
I have the code under the button which says:
SqlDataAdapter1.Update(dsCustomers)
and I added an Update command to the adapter with an sql statement saying:
UPDATE Customers SET Firstname = @FirstName WHERE ID = @ID
But thats when it all goes to pot. I get an error back when I click Save, that says: Must declare the scalar variable @ID.
Also, Im thinking, I have a grid with 10 records, so how does the Updatecommand in the adapter apply its changes to each record? Is my UpdateCommand sql statement incorrect?
Cant find any MSDN walkthroughs that sort this.
Regards
Mark
|
|
|
|
|
Hi Mark,
First of all you should write if u r working on web or desktop and which version 2003 or 2005. These info will help others in giving you answers.
Waiting for your reply.
Thanks
chiranjeeb
|
|
|
|
|
|
Ok,
Ive come up with a solution to the problem.
In my save function, I modified it to:
<br />
Dim builder As New SqlClient.SqlCommandBuilder(SqlDataAdapter1)<br />
SqlDataAdapter1.UpdateCommand = builder.GetUpdateCommand<br />
SqlDataAdapter1.Update(DsCustomers)<br />
Which seems to solve the problem.
However, why doesnt the SqlDataAdapter wizard create the necessary add/update/delete commands? Is that a bug? I tried it again, on another table, and the wizard just says "there were problems trying to create the UPDATE command"
Strange
|
|
|
|
|
We are creating one porject as Desktop app with VB.NET .My problem involves in 2 cases
Case 1 :I want to write sub main() in module and i want this as startup object for the exceution but in 2005 we are unable to keep this because it will be avilable only if aplication is Console,if i keep this when i excutes it opens Console,Login page both.So how can i start execution from SUB MAIN() of module ?
Case 2:If i keep Login form as Startup object,after validating Login i wnat to display MDI form and i want to close Login form.How can i achieve this?
Please Help me
Thanking you in advance
|
|
|
|
|
Ganesh India wrote: Case 2:If i keep Login form as Startup object,after validating Login i wnat to display MDI form and i want to close Login form.How can i achieve this?
In your static void main, show the login form and if it succeeds, show the main form.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
There will be no Static Void Mian() in VB.NET its avilable in c#.net.
If we want to write sub main in Module we hage to write like
Public Sub main()
Dim x As New frmLogin
Dim y = x.ShowDialog()
If y = 1 Then
Dim frm1 As New MDIForm1
frm1.ShowDialog()
End If
'MessageBox.Show(y.ToString())
End Sub
|
|
|
|
|
Ganesh India wrote: If y = 1 Then
y = 1 ?? Is 1 the value of DialogResult.OK ? Even then, why do it this way ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
We can keep no problem ,its not the original issue after succesfully login what code i have to write to show MDI form, and what i have to do this login form ?
|
|
|
|
|
It's not the problem, it's just really bad code.
I don't get it - this code looks like it will show your MDI form, so what is the question ? Does this not work yet ? Is there no actual login form ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
See i have to keep frmLogin as SatrtUp object am i right?
if i keep Login as StartUp and after successfully login i have to show MDI form to the user.Its happening but what i have i do that Login form? because its already opened and there only we called MDI.
|
|
|
|
|
You could use
Sub Main()
Dim frmL as New frmLogin
Dim frmM as new frmMDI
Application.Run(frmL)'run login form
Application.Run(frmM)'run MDI form
End Sub
|
|
|
|
|
Please How to send info out the lpt port(Write)??
|
|
|
|
|
|
Hi,
I'd like to let my program respond if the ENTER key is pressed. I tried windows.forms.keys.enter but i just can't let it work. Error messages keep showing up or the program doesn't respond at all. I want to let the program respond with ComboBox1_KeyPress (and then the enter key)
--Zaegra--
|
|
|
|
|
Zaegra wrote: Error messages keep showing up or the program doesn't respond at all.
Sounds like you need to post the code and the errors you are getting
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Zaegra,
You need to turn on the keypreview property of the form to react to a form wide return key stroke. otherwise you have to add a kepress event on every control reacting to the return key.
Private Sub Form_KeyUp(ByVal sender As Object, ByVal e As system.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
If e.KeyCode = Windows.Forms.Keys.Return Then
'do whatever
End If
End Sub
nathan
|
|
|
|
|
Use the KeyDown Event (or any event that uses System.Windows.Forms.KeyEventArgs )
|
|
|
|
|
Thanks guys
--Zaegra--
|
|
|
|
|
hi,
how can i put a Progressbar in myproject to show the progress of a database operation.
i put one ,but it is not working simultaneously with the dataaccess
can anybody help me
|
|
|
|
|
Did you expect it to work by magic ? It will show progress based on how you set it. If you're calling a database, it cannot show progress, as the activity is atomic - the first you know about it is when the call has returned.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|