Need Help Here.......
I'm using visual VB.NET
I was wondering about what is the best way to go about creating a listview.i need to do this beacuse i wish to highlight columns as well as rows (which the listview in VB.NET dose not support as far as i know).
How to insert the value that user have entered combobox and click button.The value will sent into database.This is in form1.
In form2,if click button it will display in listbox.There also got another button to to delete the value according the index have chose using cursour.
I'm using microsoft sql server,the were connection problem.How to know the server name for my computer. Below is the coding I have done but cant work......
Database name is testing table name display,field is value
To view the record in your listbox is just like this:
Public Function Query(ByVal SQL As String, ByVal SQLCon As SqlConnection, ByRef DS As DataSet) As Integer
Dim DA As New SqlDataAdapter(SQL, SQLCon)
Query = DA.Fill(DS)
DA = Nothing
End Function
Public Function Execute(ByVal SQL As String, ByVal SQLCon As SqlConnection) As Integer
Dim cmd As New SqlCommand(SQL, SQLCon)
cmd.ExecuteNonQuery()
cmd = Nothing
End Function
------ END OF YOUR FUNCTION
---- VIEW THE RECORD IN LISTBOX
Dim strSelect As String
Dim dset As New DataSet
Dim nrow As Integer
Try
strSelect = Query("Select * from display", con, dset)
con.Open()
For nrow = 0 To strSelect - 1
ListBox1.Items.Add(dset.Tables(0).Rows(nrow).Item( "value"))
Next
con.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
----DELETE THE SELECTEDITEMS IN LISTBOX
ListBox1.Items.Remove(ListBox1.SelectedItem)
------TO KNOW YOUR SERVER NAME
go to program select the sql server 2000 then choose SQL Server Service Manager. your server name will appear in Server combobox.