Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order. btn_addline : Private Sub btn_addline_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_addline.Click grd_order.RowCount = grd_order.RowCount + 1 End Sub everything to do with lst_product: lst_product.DataSource = run_sql_query("SELECT * FROM TBL_PRODUCTS_A154287 ORDER BY FLD_PRODUCT_ID ASC") lst_product.DisplayMember = "FLD_PRODUCT_ID" **//This code snippet lets user click on a product id in the list and populates the …

Member Avatar
Member Avatar
+0 forum 9

Hello Daniweb Community, I was wondering if there is a way to replace words from a listbox. So at the moment I've got a listbox with a couple of strings to be replaced in the textbox, however single line listbox items work but when I add a multi-lined item eg. Hello There It'll go into the listbox as HelloThere, so when I go to use the for each to replace them It doesn't work. I've tried manually replacing it by using `TextBox1.Text = TextBox1.Text.Replace("Hello" & Environment.NewLine & "There")` it'll work, and if I try For Each lbItem In .ListBox1.Items TextBox1.Text …

Member Avatar
Member Avatar
+0 forum 3

Hi all! I have a form with a combobox, a listbox and 2 command buttons.(see photo and neglect the blank listview) I select items from the combobox and add items to my listbox after clicking the button.(no problem with this) Then, I need to save each item of the ListView to my database. There can be more than one item in the Listbox,depending on how many were added by the user. I was thinking of a way to loop through the items and add each one, and stop adding when all have been saved to a database. I tried this, …

Member Avatar
Member Avatar
+0 forum 5

Hi. I have a program that detects all the folders that are open and displays each one in a ListBox item. ![2014-12-25_15_49_20-DLAUBEFN_(Running)_-_Microsoft_Visual_Studio.png](/attachments/large/4/8dcefef15b7155ed7cc20f56c743d34f.png "align-center") What I want it to do is if a certain folder is closed, I want it to start a batch file and close itself. I know how to make it do these things but there's a problem. Here's my code: Imports Shell32 Public Class Form1 Dim open As Integer Dim Lb As New ListBox Dim WithEvents RoutineTimer As New Timer Private Sub Form1_Load() Handles MyBase.Load Lb.Parent = Me Lb.Dock = DockStyle.Fill Me.Text = "XPLHHNSJKHF 1.0" RoutineTimer.Interval = …

Member Avatar
Member Avatar
+0 forum 5

Hi..i m new here..i want to ask some little help..how can i save the listbox items into binary file? The items should write at specific location which is offset 0x2E (item1), 0x9A (item2) and 0x106 (item3)..each offset separate by 108 length..

Member Avatar
Member Avatar
+0 forum 1

I am trying to add a coloumn from database into a listbox in VB6. The following code works. The selected item from this listbox is used to find and add records to the ListBox2. Using Oracle 11g Express Edition and Visual Basic 6. Working code: (Displays the artist column from a music database) Private Sub Command3_Click() Dim con As New ADODB.Connection Dim rec As New ADODB.Recordset Dim ConnStr As String Dim SQL As String ConnStr = "DSN=MusicDB" SQL = "Select artist FROM music" con.Open ConnStr, "SYSTEM", "PASSWORD" rec.Open SQL, con, adOpenStatic, adLockOptimistic Do While Not rec.EOF List1.AddItem rec.Fields("artist").Value rec.MoveNext Loop …

Member Avatar
Member Avatar
+0 forum 1

I want a set of not the same numbers to be added to a listbox, if there are any numbers that are the same, then they won't be added. I tried: If (Number1 = Number2) Or (Number1 = Number3) Or (Number1 = Number4) Or (Number1 = Number5) = False Then ListBox1.Items.Add(Number1 & " " & Number2 & " " & Number3 & " " & Number4 & " " & Number5) End If However I still got ## 10 10 50 29 36 13 ## the first two numbers are of the same value, and yet they somehow managed to …

Member Avatar
Member Avatar
+0 forum 7

I have a listbox which contains items in it. After you click on the selected item, the listbox will be populated with different items relevant to the item which you clicked on. What I want to make, is instead of having to click on the selected item, I want to press the Enter key when an item is selected, and that way I won't need to click on the items. This is what I tried for a KeyDown event: Private Sub ListBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles ListBox1.KeyDown If (e.KeyCode = Keys.Enter) Then ListBox1_SelectedIndexChanged(sender, e) End If End Sub

Member Avatar
Member Avatar
+0 forum 3

What I have is a listbox with items imported from the database. From the Data Sources (Shift+Alt+D) I've dragged a table in the form of Details, instead of DataGridView. What I'm trying to figure out, is how to make the information to be displayed in the Details when an item is selected from the listbox. See the picture for clarification.

Member Avatar
Member Avatar
+0 forum 6

Friends , Is there any way for data alignment in the list box. My code is given below Private Sub TxtFdt_KeyPress(KeyAscii As Integer) Dim L, L1, L2, L3, L4, L5 As Integer Select Case KeyAscii Case vbKeyReturn If TRS.State = adStateOpen Then TRS.Close TRS.Open "SELECT * FROM Tran WHERE Ac = '" & TxtAc.Text & "'" & "and Acno=" & Val(TxtAcno.Text) & "and Tdate>= #" & TxtFdt.Text & "#" & "ORDER by Tdate,Trnno", CN, adOpenStatic, adLockOptimistic If TRS.RecordCount = 0 Then MsgBox "NO TRANSACTION FOR THIS PERIOD !", vbInformation, "PEBBLE" TxtFdt.SetFocus Else TRS.MoveFirst List1.Clear Do Until TRS.EOF L = Len(Left(TRS!Tdate, …

Member Avatar
Member Avatar
+0 forum 2

If you use the Windows OS, then IronPython allows you to create a GUI program taking advantage of the .NET framework. You also have the option to compile the program into a standalone .exe file (and the needed .dll file).

Member Avatar
Member Avatar
+3 forum 2

I have a database with items which I want to populate to a listbox. The first image shows how its right now, and the second shows how I want the final result to look like. ![dd3aaa66fdb74cecb5cca11999b6b6dc](/attachments/small/3/dd3aaa66fdb74cecb5cca11999b6b6dc.png "align-left") ![2645978b29622fc539c0725c199c3e13](/attachments/small/3/2645978b29622fc539c0725c199c3e13.png "align-right")

Member Avatar
Member Avatar
+0 forum 2

Well I'm trying to make a program that have ListBox1 which when the button1 is pressed the Listbox1 will show all the open windows of notepad, like get notepad.exe and it will show Example the name: Untitled - Notepad nothing else, i have a code right now that i found but it Shows a few things, look at this picture. [url]http://img37.imageshack.us/img37/1241/getn.png[/url] It says MSCTFIME UI And Default IMe, i don't want that to show... This is the code i have right now. Form1 [CODE]Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Lst = Me.ListBox1 EnumWindows(AddressOf EnumWindowsCallBack, …

Member Avatar
Member Avatar
+0 forum 5

I have a multiselection listbox. I want to see the last selected item (which the user just selected). I can't find any way to do this googling.. Thanks in advance.

Member Avatar
Member Avatar
+0 forum 5

Hi, I need to List a number in a listbox if the number is closer to another number. Eg. Num1 = 98 Num2 =100 If 'num1 is close to num2' Then Listbox1.Items.Add(num1) End If Please Help Me. Thanks.

Member Avatar
Member Avatar
+0 forum 1

I'm trying to select items from the listbox when pressing Enter on the selected item. Here is what I have tried so far: Private Sub ListBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ListBox1.KeyDown Select Case e.KeyCode Case Keys.Enter ListBox1.SelectedItem = ListBox1.PerformMouseClick() End Select End Sub

Member Avatar
Member Avatar
+0 forum 1

I need to make one statement to select either of the items in listbox and show the same label, regardless of which item is selected. I've tried someting like If Me.ListBox1.SelectedItem = "R115" Or "Bay, Charles" Then Label1.Text = "Address Information Avaliable" End If But it doesn't work. The code below works but I need to make it shorter. If Me.ListBox1.SelectedItem = "R115" Or Me.ListBox1.SelectedItem = "Bay, Charles" Then Label1.Text = "Address Information Avaliable" End If Any suggestions?

Member Avatar
Member Avatar
+0 forum 2

I am having trouble on how will I solve this problem. I want only to refresh the value of listbox after adding a value from textbox using onclick() on an image. <form id="UpdateDetails"> <input type="hidden" name="id"> <input id="adnew" type="text" autocomplete="off" name="addnew" class="xx"> <img id="img" onclick="addnew()" src="images/icons/add-icon.png" style='padding:0 0 0 10px;height:15px;width:15px;cursor:pointer;' title='Add New' /> <span id="checkStatus"></span><br/> <select multiple> <?php $id=$_POST['id']; $sq = mysql_query("SELECT testVal FROM x_file WHERE id='$id'"); while($q = mysql_fetch_array($sq)){ echo "<option value=".$q['testVal'].">".$q['testVal']."</option>"; } ?> </select> </form> <script> function addnew(){ $.ajax({ type: 'post', url: 'addnew.php', data: $('#UpdateDetails').serialize(), success: function (info) { $('#checkStatus').fadeIn(250).css('color', '#017c04').html(info).delay(1000).fadeOut(500); clearInput(); } }); } </script>

Member Avatar
+0 forum 0

I am trying to add the History page in my application which will work like as i shown below: 1st Column: (Date); 2nd column: (Login Time); 3rd Column: (Logout Time) I added the following code: Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ListView1.Items.Add(DateString) ListView1.Items(0).SubItems.Add(TimeOfDay) End Sub End Class This all my efforts now what I am Facing ? I want to save all the data of this in the settings. And One more things is I am unknown how to add the Subitem. The above code will just replace the **1st** Items …

Member Avatar
Member Avatar
+0 forum 4

I'm running a search query that pulls the search string from one textbox then searches a listbox for the string and displays the results in a second listbox. I would like to define the number of items that it returns based on a second text box. So far I am able to get all list items with the given string to show in the second box. But I have yet to get it to limit the search to 1 item etc. The functioning code I've used to show all results is: Private Sub btnGo_Click(sender As Object, e As EventArgs) Handles …

Member Avatar
Member Avatar
+0 forum 1

Hello! I got a neaty tricky situation here.. I have a picturebox1 and listbox1 and a few items in listbox1. I got images in resources.resx (bmp) and want to load different images depending on what index is selected.. I wanted for it to be something like this.. Bitmap bmp = Properties.Resources.Image_ + listBox1.SelectedIndex; pictureBox1.Image = bmp; as my images are named Image_0, Image_1, Image_2 and so on.. I wanted the number of the index to get to the Image_* so that I don't have to rewrite the code for each image.. how can I do that?

Member Avatar
Member Avatar
+0 forum 4

good day.. i have a slight problem in my enrolment sytem. im new in vb programming, and this problem perfectly work in stressing out and pressuring me as begginer. i have a listbox that contains all filtered data from my database. and i want it (all entry in the filtered listbox) to be exported to ms excel. i tried searching on different forums but it doesnt resolved my problem. im using visual studio 2012 by the way. can somebody could run me through this problem?

Member Avatar
Member Avatar
+0 forum 3

Hi guys, I am trying to change color of the existing items in my listbox. Can somebody please help?

Member Avatar
Member Avatar
+0 forum 2

Hi, I read many articles about this, but I still couldn't manage to solve it. I want to select the item of a listbox with MouseEnter event. It should be something similar like this Private Sub LBox_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles LBox.MouseDown If e.Button = MouseButtons.Right Then Dim index As Integer = LBox.IndexFromPoint(New Point(e.X, e.Y)) If index >= 0 Then LBox.SelectedItem = LBox.Items(index) Debug.Print(LBox.SelectedItem) End If End If End Sub Would appreciate your help. Thank you.

Member Avatar
Member Avatar
+0 forum 8

Hi, i am trying to edit a list box item in a way that if certain item is already present it should update it and if item is not present then it should add it to a list box what should i do Detailed i have a dynamic button which is associated with the products in product table that mean i would be having as much buttons as products i have now on click event i want to add them to a list box in the same cenerio as i explained above here's my logic and code i have added …

Member Avatar
Member Avatar
+0 forum 2

hey people. ok.. this is what i NEED to do.. Task > 1. User will add TODO list in the textbox shown in the GUI Windows Form. > 2. User will also select the date on which the task will be done. > 3. Once entered the above information, user will click on Add TODO button and the TODO > text from the textbox will be added to the listbox shown on the bottom of the Windows > Form. > 4. User can add as many items as he wants. > 5. If user has entered a task in June …

Member Avatar
Member Avatar
+0 forum 3

Hi guys. I'm stuck. How can I use a custom color (rgb 25, 25, 25)(for example) as my fill rectangle color instead of the default blue? 'Private Sub ListBox10_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles ListBox10.DrawItem ' e.DrawBackground() ' If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then ' e.Graphics.FillRectangle(Color.??, e.Bounds) ' End If ' Using b As New SolidBrush(e.ForeColor) ' e.Graphics.DrawString(ListBox10.GetItemText(ListBox10.Items(e.Index)), e.Font, b, e.Bounds) ' End Using ' e.DrawFocusRectangle() 'End Sub

Member Avatar
Member Avatar
+0 forum 7

Hi Everyone I've been looking for a solution to this problema for a while, ive searched the net but still can't get this too work. if i put my code in the default asp template( http://i1.asp.net/asp.net/images/whitepapers/aspnet40/ASPNET4B1-image13.png?cdn_id=2013-05-08-001 ) it will work, but when i use my template i always get the listbox Selecetedindex as -1. here is a example of what happens when i try to inspect the value using chrome. http://s21.postimg.org/3jsi8351z/weird.png Someone please help me. here is my code. using System; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Linq; using System.Web.UI.WebControls; public partial class permissaotop : System.Web.UI.Page { protected void …

Member Avatar
Member Avatar
+0 forum 3

Windows Application Form: I have a problem with filtering winform datagridview by listbox items (multiselect). For example: My listbox items have guest name of 'Lim', 'Jack' and 'May'. I would like to filter my gridview data by these 3 guests. Which each guest has their own entry. This is my code and it does not work. Thanks switch (cbField.SelectedIndex) { case 0: Filter = ""; break; case 1: string FilterStart = "GUEST like '%"; string FilterMiddle = ""; string FilterEnd = "%'"; for (int i = 0; i < lbSearch.Items.Count; i++) { string[] filterEntry = new string[lbSearch.Items.Count]; filterEntry[i] = src.searchreplace(lbSearch.Items[i].ToString()); …

Member Avatar
Member Avatar
+0 forum 1

Form1 is a pop out windows from Form2. Form1 has a listbox1 with items and when I clicked the 'Continue' button in Form1, it will pass all the items in the listbox1 to listbox2 which is located in Form2. I would like to ask how the button_click in Form1 will pass the listbox1's items to Form2's listbox2. Thanks

Member Avatar
Member Avatar
+0 forum 4

The End.