473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

problem: VB.NET listview

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
Apr 9 '07 #1
1 1286
klaydze
30
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.
Apr 18 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Steph. | last post by:
I use a ListView in a form to display Data from an SQL db. My problem is that I can fill the listview in less than a second when I show the form AFTER filling the listview, but I take 35...
1
by: newbie001 | last post by:
I have the following code in a listview control's initList function (called from form_load event). i can't understand why the listview box still appears blank with no columns or listview items. ...
1
by: J_Max | last post by:
Hello, This might be a really easy question, but... I am developing a simple Smart Device application that uses a listview. I have a function that adds a item to the listview - code is below. I...
3
by: Larry | last post by:
I've set up a list of image filesnames in a listview control(lvSrcFileList), I'm using the selectedIndexChange event to select which file is being displayed in a picturebox control(pbImagePreview)....
7
by: David Schwartz | last post by:
I am using a few ActiveX ListViews in my VB.NET Windows Forms application. I have the ListView's HotTracking property set to False, yet when I move the mouse over an item in the ListView (without...
2
by: Matt Michael | last post by:
Hi, I'm having a problem working with a listview in an application I'm writing. Currently, whenever the selectedindex changed event fires, it loads up a htmledit control, and other labels on the...
7
by: Dino Buljubasic | last post by:
Hi, I am using C# 2.0 (VS2005) to build my user control that contains a number of dynamically loaded ListViews. ListViewItems have their ForeColor properties set to either black or blue to...
12
by: garyusenet | last post by:
I have had no replies to my previous post so perhaps I didn't write it good enough. Please excuse new thread but i wanted to break from the last thread hopefully this thread will be better. ...
2
by: Paul W | last post by:
Hello, My problem concerns the shell. If there's a better forum for this post, please let me know. I'm trying to create a ListView control that displays the contents of a folder with all the...
0
by: =?Utf-8?B?SWdvcg==?= | last post by:
Hi everyone! I have some strange behavior of ListView control in WPF. We are developing application in C#. I created ListView with some items and set SelectedIndex to some index in the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.