473,320 Members | 1,724 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,320 software developers and data experts.

i have 7 listbox no. of items when i click 3 listbox item it will dispaly image

1
Here my code.vb.net with forms
i want to retrieve the images from sql server when i click item in listbox dynamically change and display the image in picture box
Expand|Select|Wrap|Line Numbers
  1. ListBox4.Items.Clear()
  2.         ListBox5.Items.Clear()
  3.         ListBox6.Items.Clear()
  4.         ListBox7.Items.Clear()
  5.         Dim connString As String = "Data Source=HASEE-PC\SQLEXPRESS1;uid=sa;pwd=test123;database=TDM"
  6.         Dim conn As New SqlConnection(connString)
  7.  
  8.         conn.Open()
  9.         'For i As Integer = 0 To ListBox1.SelectedItems.Count - 1
  10.         '    users = ListBox1.SelectedItem(i).ToString
  11.         'Next
  12.         Dim sql As String = "  SELECT DISTINCT man   from kdblist where  subassembly='" + ListBox1.SelectedItem + "' AND operation='" + ListBox2.SelectedItem + "'AND issues='" + ListBox3.SelectedItem + "'"
  13.         Dim cmd As New SqlCommand(sql, conn)
  14.         'Dim tracebox As String
  15.         Dim reader As SqlDataReader = cmd.ExecuteReader()
  16.         Do While (reader.Read)
  17.  
  18.             ListBox4.Items.Add(reader("man").ToString)
  19.             ' ListBox5.Items.Add(reader("method").ToString)
  20.             ' ListBox6.Items.Add(reader("material").ToString)
  21.             ' ListBox7.Items.Add(reader("machine").ToString)
  22.             PictureBox1.ImageLocation = "C:\Visual_Basic_Projects\movies_01\movies_01\bin\ Debug\thumb_pics\" & "tn_" & TextBoxPictureFilePath.Text & ".jpg"
  23.         Loop
  24.         ' If ListBox4.Text = "" Then
  25.         'ListBox5.Items.Add(reader("material").ToString)
  26.         'End If
  27.  
  28.  
  29.  
  30.     End Sub
Apr 14 '14 #1
0 892

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

Similar topics

10
by: SueB | last post by:
Hi. Is there a way to "unselect" items in a listbox, programmatically? Here's what I want to do (and I've been trying to to this while debugging the form, but I've been unsuccessful) ... I...
6
by: Valerian John | last post by:
I have a ListBox webcontrol on an aspx page. Items are added to the ListBox using client-side code. However, when the page is posted back the items are missing/not available. (It is like the...
3
by: Stimp | last post by:
I have a listbox of values that I populate from a database. I want the user to be able to re-order the list (by first selecting an item and then clicking 'up' or 'down' buttons) and then save...
4
by: Ron | last post by:
I've got a listbox that holds a list of groups. Users can select a group, hit the remove button and the group should be removed from the listbox. The only problem is that no matter which group you...
2
by: K B | last post by:
Hi, The following code has been successful for me in the past and i just can't figure out where I'm going wrong. When I debug I keep getting the two top items as selected even though there are not...
1
by: Tomas | last post by:
Hello, What is the easiest way to copy Items from one ListBox to another ListBox using asp.net code? Regards, Tomas
2
by: vinod allapu | last post by:
hi all, i am trying to generate a report, iam using sql server 2000 and Asp.net 2.0. First to select the columns iam using the list box... as we can order by the query result from the...
0
by: vivek kapile | last post by:
Title: Javascript for Adding & Removing Items from a one Listbox to another Author: Vivek Kapile Email: snipped Language: JavaScript Platform: Javascript in ASP.net...
1
by: kumsay | last post by:
hello, I have a form with 2 listboxes. Listbox1 is populated with symptoms. If a symptom is selected, listbox2 will show the related illnesses having that symptom. Here's my working code: Call...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.