Click here to Skip to main content
15,887,822 members
Everything / Programming Languages / Visual Basic 11

Visual Basic 11

VB11

Great Reads

by Niemand25
A simple way to place any ObjectListView inside a ComboBox
by Thava Rajan
Copy and insert data at any postion in your datagridview
by Thava Rajan
This tip is used to fix a workaround for a bug in double click on checkbox
by Chris Jorna
Communication Library Files - NetTools | IsSameSubnet

Latest Articles

by Niemand25
A simple way to place any ObjectListView inside a ComboBox
by David Vanson
Generate you own barcodes for your business, Promotional items or to share links with friends.
by Terence Wallace
The primary purpose of this article is to provide quality sample source code for VB.NET developers interested in building data-centric applications using the .NET Framework.
by Chris Jorna
Communication Library Files - NetTools | IsSameSubnet

All Articles

Sort by Updated

Visual Basic 11 

19 Sep 2023 by Jim Harrison 2023
Server logs: Quote: 15:14:08:Operating System: Windows (Microsoft Windows 11 version 10.0.22621) 15:14:08:CPUs: 12th Gen Intel(R) Core(TM) i5-1235U (Intel) 15:14:08: 1 CPU x 10 cores. 12 logical processors (x64)...
17 Sep 2023 by OriginalGriff
This would be better posted in the dedicated forum: CodeProject.AI Discussions[^]
9 Mar 2023 by Michel van der Laan 2023
I have an unzipped xlsx document that consists of two xml documents, sheet1.xml and SharedStrings.xml. Both have a xmlNameSpaceManager : Dim workSheetManager As New XmlNamespaceManager(workSheet.NameTable) ...
19 May 2022 by Member 3892343
I have an application in VB .Net that connects to a database MS SQL. It is connected to a datagridview, the problem is when I add a new record when I update the dataset it accepts the 2 first cell values but the third cell becomes blank, if I...
6 Jul 2021 by Member 3892343
Youre right i used bindingsource instead Ty
6 Jul 2021 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
30 Jul 2020 by Member 14903326
i need to convert this code to visual basic for a proyect that i did not know that was to be in viasual basic form and to be honest i don't have much time so if anyone can help me that could be amaizing What I have tried: #Se muestran los...
30 Jul 2020 by ilmualam
Thank you so much for this kind of question. This is what I want to know, THANK YOU.
30 Jul 2020 by OriginalGriff
Step 1: Learn Python. Step 2: Learn VB Step 3: Use the Python code as a specification for a new VB app. Never convert languages, it doesn't produce good code in the target language because it uses a totally different framework, and the data...
27 May 2020 by Patrice T
Quote: I get problem index was out of range. Error message also tells you the position of error (line number), it helps to spot the problem. Are you sure that DataGridView2 have at least same number of rows than DataGridView1 ? For...
27 May 2020 by Member 14841900
Dim TDate As Date Dim Batch As String Dim Product As String Dim Code As String Dim Material As String Dim Quantity As String For i As Integer = 0 To DataGridView1.Rows.Count...
20 Mar 2020 by Ralf Meier
The following Code shows you a method (written by me) which calculates the possible Fontsize for a given Size - I think you can easily change it to a Rectangle : Function GetFontSizeMatch(ByVal myText As String, ByVal myFont As Font, ByVal...
20 Mar 2020 by Member 13358124
I try to write codes to get the correct font size that fits to the given box. Here I gave New Rectangle(0, 100, 100, 100) as a new new rectangle. But sometimes it dose not give the correct font size when there is two text lines in the box. Help...
20 Mar 2020 by OriginalGriff
An SqlConnection can only support one DataReader at a time: when you "share" a connection you have to make sure that the reader is closed and disposed when you are finished with it at all times. The best approach is not to "recycle" SQL...
20 Mar 2020 by codejet
Try enabling MutipleActiveResultSet in your connection string add this MultipleActiveResultSets=True
20 Mar 2020 by Xion1624
Private Sub tmchat_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmchat.Tick Using cmdreadchat As New MySqlCommand("SELECT chat FROM tb_chat", Conn) Dim chatreader As MySqlDataReader ...
20 Mar 2020 by ZurdoDev
You are closing the reader inside of the loop where you are reading from it. Move your close code to outside of the loop.
19 Mar 2020 by Member 13358124
ant test1 test2 test3 ...
19 Mar 2020 by Maciej Los
Check this: string xcontent = @" ant test1 test2 test3 ...
16 Mar 2020 by Xion1624
Private Sub tmchat_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmchat.Tick Dim cmdreadchat As New MySqlCommand("SELECT chat FROM tb_chat", Conn) Dim chatreader As MySqlDataReader chatreader =...
16 Mar 2020 by Dave Kreskowiak
It appears that you made the mistake of using a single SqlConnection object throughout your entire class. That's the wrong way to do it and leads to problems like this. ALWAYS create your connection when you need it, like in this method you...
16 Mar 2020 by OriginalGriff
An SqlConnection can only support one DataReader at a time: when you "share" a connection you have to make sure that the reader is closed and disposed when you are finished with it at all times. The best approach is not to "recycle" SQL...
24 Jul 2018 by Member 13824773
Trying to avoid booking a lesson twice on the same date and same time. got this code from youtube but it's not working for time. If i change to @name or something other than time it will work. please help What I have tried: Imports System.Data.OleDb Public Class Form1 Dim myconnstring...
24 Jul 2018 by Jochen Arndt
What is TimeDateTimePicker? If that is a DateTimePicker Class (System.Windows.Forms)[^], use TimeDateTimePicker.Value to get the value as DateTime object. Note also that TIME is a reserved word and must be therefore enclosed by square brackets when used as field or table name (which should be...
24 Jul 2018 by OriginalGriff
Start be reading the code and working out what it does, and how it does it. It's fine and dandy to find code on the internet, but if you don't want it to do exactly what it did in that application, you will always need to modify it to suit your needs. And that means understanding how it works,...
26 May 2018 by OriginalGriff
No. The standard RichTextBox control is really very basic - there is no way to "extend" it to multiple pages. It may be that you can find a "better" rich text box - try Telerik and DevExpress, they both have extended RTB's though I haven't tried them. The other alternative is to write your own...
26 May 2018 by User 13023712
Till now, I have made a pretty advanced rich text editor. However, is there any possible way with which I can make the Richtextbox multi-paged? ( sort of like Microsoft Word ). PS: I am using a custom Richtextbox to support printing. Thanks! What I have tried: I tried using panels to white...
3 May 2018 by Prashant9813
Hello I am Developing A web Browser. And I have Tested That browser on facebook and Google It worked Perfectly but whenever i open Flash like SWf games From this Link :- Y8.com Then It stopped Loading . Just Ads Pop Ups. Anybody can Help Regarding This Problem. What I have tried: I Have...
21 Mar 2018 by Maciej Los
If you would like to get a list of TextBoxes, which name is txtBoxN (where N is a number) and TextBox is not empty, then try this: Dim pattern As String = "^txtBox\d$" Dim r As Regex = New Regex(pattern) Dim notEmptyTextBoxes = Me.Controls.OfType(Of TextBox) _ ...
21 Mar 2018 by faiqaa
I am using a total of 7 text boxes, six of them are named txtBox1,txtBox2,txtBox3,txtBox4,txtBox5,txtBox6, the seventh is named txtBoxSearch,I have tried using the code below to carry out a presence check, the problem is that I only want to carry out the presence check on the first 6 text boxes,...
17 Mar 2018 by ATeDe
Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ' Button to validate Phone numbers typed into TextBoxes Dim emptyTextBoxes = From txt In Me.Controls.OfType(Of TextBox)() ...
17 Mar 2018 by faiqaa
The form allows me to save customer details in a text file when the button "save" is pressed, I am also carrying a presence check and a length validation of the phone number inputted in a text box every time the user presses save. The problem is that when the validation fails the customer...
16 Mar 2018 by ATeDe
Hi j snooze I think, this is what you might looking for? I'm not very familiar with Forms and all that jazz in VB.NET, also tomorrow we have St Patrick celebration here in Ireland, so I wrote quickly this piece of code. txtBoxes array of string simulates content of your real TextBoxes. This...
3 Mar 2018 by Richard MacCutchan
Why have you posted this question? It is the same issue as you already posted at How to sort listbox rows using first item in VB?[^].
2 Mar 2018 by Richard MacCutchan
StringBubbleSort(arr) You have not defined that subroutine anywhere.
2 Mar 2018 by faiqaa
I am saving stock info such as product ID,Product name,price and quantity. I want to be able to sort by product ID using a bubble sort. I am first loading the data into the list box from the relevant text file and then sorting. I have tried using the one below but it doesn't not seem to...
2 Mar 2018 by OriginalGriff
You can't read "a specific item" from a text file, because it doesn't have any implicit order - in fact even lines are just an interpretation of characters within the file: each time a newline character (or character pair, depending on the operating system) is encountered, that is the end of the...
2 Mar 2018 by faiqaa
I am trying to display a message box based on the quantity regarding certain products saved in rows of data (4th item) in a text file, I know how to read each row but not how to only read a specific item.Does anyone have any idea? Let me know,thanks in advance. Below you can see what code...
2 Mar 2018 by RickZeeland
You could try something like this: File.WriteAllText("C:\Users\Windows 7 User\Desktop\Average.txt", "blahdiblahblah") Dim value As String = File.ReadAllText("C:\Users\Windows 7 User\Desktop\Average.txt") See: File.WriteAllText Method (String, String) (System.IO)[^]
2 Mar 2018 by faiqaa
This form allows me to calculate the monthly average when I click the respective button, I want to be able to calculate the average display it in a label and then save this value into a text file and when calculating another average I want to be able to display the previous value calculated...
1 Mar 2018 by Richard Deeming
Don't encrypt it; hash it. Secure Password Authentication Explained Simply[^] Salted Password Hashing - Doing it Right[^] Generate a random salt for each password; append (or prepend) it to the password bytes; then generate a one-way hash of the password. Store the salt and the hash in your...
1 Mar 2018 by faiqaa
In my Login form the user needs to input the username and password in the relative textboxes and then press the button LOGIN. The username and password are already saved into a text file, every time the user tries to enter the username and password entered by him will be matched with the ones...
2 Nov 2017 by Mrunal Sonawane
Hey... I made my own database and imported that database to Visual Studio using the DataGridView control... Do the same and then use this... Public Sub ExecuteColoring() Try Dim numberRows As Integer numberRows = DataGridView1.Rows.Count - 2 'We...
2 Nov 2017 by Rabee Qabaha
i want to change the backcolor for buttons depends on information from database, i have form has multiple buttons like this picture bellow. I have a database table for shops (stores),There is a column in this table that contains the shop number and a column for its status : Yes or No (if rented...
4 Jul 2017 by OriginalGriff
Start by adding two columns to your Table: The first is an INT IDENTITY column called Ident, autoincrementing by one The second is a DATE column called InsDat which defaults to GETDATE() Then when you want the rows with a daily sequence use this: SELECT m.Ident, m.InsDat, m.OtherColumnList,...
4 Jul 2017 by Member 13293441
i want to print label with label_id label id format contain running number which is 0001 (0001,0002,..) -i want to reset the running number to 0001 when the new day come. can someone give me some ideas or solution regarding my problem? currently, my system reset the running number if new day...
1 Jun 2017 by Dave Kreskowiak
Wait a second. You're trying to get a PictureBox control to load an Excel workbook as an Image? Yeah, that's not going to work. The PictureBox control has no idea what to do with an Excel workbook. If you're trying to show an Excel sheet in a Windows Forms Form, it's considerably more...
1 Jun 2017 by yogesh vaidya
hi, i am trying a open file dialog to bring a excel file in my program in run time but err comes "be shure about query string and memory " OFGESelectfile3 is renamed open file dialo and filter is JPEG Files| *.JPG|GIF Files|*.GIF|Windows Bitmaps|*.BMP|Excel fiels|*.xlsx What I have...
23 Jan 2017 by sebalius
I have a small program and when it runs the MDB database populates the Names into the ListBox. I have wrecked my brain trying to select a name in the Listbox and the full information to then populate the text Boxes. Eventually I wish to use the text Boxes to add new records to the database. Any...
23 Jan 2017 by Thregarth
Which you need is to read from Patients table by lstnames selected value and pass others fields value to textboxes 'Create Connection from connectionString Dim objConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Temp\Hospital.mdb;") 'Create a...
9 Dec 2016 by AndreaP92
Hello, i'm using two listview in "Detail" mode.cause i'd like to do something like this| HELLO | WORLD | HI | --- Listview2| Ch1 | Ch2 | Ch3 | Ch4 | Ch5 | Ch6 | Ch7 | --- Listview1| etc.| ... | ... and i want be able to resize each column from each listviews....
9 Dec 2016 by AndreaP92
Solved like this thank you Michael. Private ListView2Changing As Boolean = False Private ListView1Changing As Boolean = False Private Sub ListView2_ColumnWidthChanged(sender As Object, e As ColumnWidthChangedEventArgs) Handles ListView2.ColumnWidthChanged If...
9 Dec 2016 by Michael_Davies
Try either method:Private ListView1Changing as Boolean = falsePrivate Sub ListView1_ColumnWidthChanged(sender As Object, e As ColumnWidthChangedEventArgs) Handles ListView1.ColumnWidthChangedif ListView1Changing = false Then ListView1Changing = true Ch_hello.Width =...
2 Dec 2016 by Member 11328325
my codeImports System.Data.SqlClientImports MySql.Data.MySqlClientImports System.IOPublic Class ADD1 Dim conn As MySqlConnection Private imagename As String 'this code declare variable as Byte Private imagge() As Byte 'this code declare variable as...
2 Dec 2016 by $*Developer - Vaibhav*$
C# ADO.NET SqlCommand - ExecuteNonQuery[^]
8 Nov 2016 by Niemand25
A simple way to place any ObjectListView inside a ComboBox
2 Aug 2016 by ProgrammingEnthusiast
i have created an application that runs in background. when i minimize it, it will appear on the task bar. it is working fine, but when i turn off my computer, windows says that my application is blocking the shut down process. how do i close my application when i shut down my computer? i...
2 Aug 2016 by ProgrammingEnthusiast
i have already resolved it by adding this code during form_closing event of my main form.If e.CloseReason = CloseReason.WindowsShutDown Then Me.Dispose
2 Aug 2016 by Kornfeld Eliyahu Peter
There are certain talks (messages) between the Os and your application while OS try to shut down...OS actually sent a WM_QUERYENDSESSION to your application, but as you didn't handled it it got a false response, marking your application as blocking...Read this paper, to see how prepare your...
1 Aug 2016 by JU571C3
Hi, i need help to get the file name without the full path here is the code i did but is not working.Please help. filelist.Items.Clear() Dim fileinformation As FileInfo For Each files In Directory.GetFiles(path) fileinformation =...
1 Aug 2016 by ProgrammingEnthusiast
filelist.Items.Clear()Dim fileinformation As FileInfoFor Each files In Directory.GetFiles(path) fileinformation = files filelist.Items.Add(fileinformation.Name.ToString.Replace(fileinformation.extension,"").Trim)Next
1 Aug 2016 by Dave Kreskowiak
Path.GetFileName Method (System.IO)[^]Give this method the fully qualified path and it'll give you just the filename portion.
9 Jul 2016 by Sh.H.
Hi guys,Is it possible to make a virtual display, and then turn the display from my graphic card to that virtual display?(The monitor will be black then. Or maybe it turns off)What I have tried:I have tried nothing until now.
9 Jul 2016 by Dave Kreskowiak
This requires writing a Remote Display Driver[^].I hope you're into C and debugging kernel drivers because you're not going to be writing this in VB/VB.NET.
25 Jun 2016 by Sh.H.
Hi guys,Is it possible to deactivate all or any of system events?What I have tried:I tried to find something on the net, but no luck!
25 Jun 2016 by Patrice T
Quote:Is it possible to deactivate all or any of system events?'Desactivate' is a bad idea.The OS handles system events, but don't 'Desactivate' them. System events are here for a good reason, just desactivate them is weird.I suspect you try to do this as a solution to another problem that...
24 Jun 2016 by Dave Kreskowiak
That depends on exactly what you mean by "deactivate a system event".At face value, no it's not possible to turn off the raising of a system event.You can, however, just not subscribe to the them. If you don't have a handler for the event, nothing happens in your code when the event is...
10 Jan 2016 by David Vanson
Generate you own barcodes for your business, Promotional items or to share links with friends.
29 Dec 2015 by Sergey Alexandrovich Kryukov
Please see my past answer: Windows Services - problem with operating system[^].If you are talking about your own Windows Service, please see my past answers:Walkthrough: Creating a Windows Service Application in the Component Designer[^],Windows services Error[^],Configure Windows...
29 Dec 2015 by ZurdoDev
A simple google search shows this post that has several options, c# - Creating Scheduled Tasks - Stack Overflow[^]
29 Dec 2015 by Member 12164472
i would like to make a task by visual basic start when windows start
22 Dec 2015 by CHill60
Firstly - anything that is intended for logging keys, grabbing passwords, hiding from Antivirus is intended for malicious purposes. That behaviour isn't just prohibited here but on all reputable sites. You will get no help with it.Secondly - you said that your teacher asked you to make a...
11 Nov 2015 by jharding08
Looking for an easy example of how to bind data from a multi-join table dataset (main table with 3-4 foreign keys to lookup data) to a datagrid as well as textboxes and comboboxes.I'd like to be able to select from all available values in the combobox and then add/edit to the main form from...
6 Oct 2015 by Demon Slayer
I need some help from you guys, because i'm completely blocked.I'm Using the following code, to change the value of the field, but don't know why the database is not updating. I'm using SQL SERVER 2012 and Visual Studio...
12 Jul 2015 by Wendelius
One way would be to use a data table. Create data table with proper structure and then fill with the data by splitting the string.So something like:Dim dt As New System.Data.DataTable dt.Columns.Add("Col 1")dt.Columns.Add("Col 2")dt.Columns.Add("Col...
12 Jul 2015 by DamithSL
changerow = New String() {myList1(index)}dgvData.Rows.Add(row)to dgvData.Rows.Add(myList1(index).Split(New Char() {","c}))
12 Jul 2015 by EMSIarma
Hello,I would like to ask for a help because I'm really stuck for a few days while searching for any possible hints for this.I'm using VB 2010 Express.I have a multiline text box (filled manually - not from the external file) with content like:A,123,abcB,456,defC,789,ghi... and I...
22 Jun 2015 by Terence Wallace
The primary purpose of this article is to provide quality sample source code for VB.NET developers interested in building data-centric applications using the .NET Framework.
15 Jun 2015 by babero
I'm using Edraw Office Viewer to embed microsoft office in vb10. There's no problem in opening, saving, creating a new document but i want to load a document in the edraw office viewer instead of opening a dialog box and locating the document manually. I already stored the path of the document...
26 May 2015 by Maciej Los
You have to use ADODB.Command[^] together with Execute[^] method to update your data.For further details, please see:Using ADO with Microsoft Visual Basic[^]ADO Code Examples in Visual Basic[^]How to Reference ADO 2.0 in Visual Basic[^]
26 May 2015 by Slow Eddie
I think your problem might be that the connection is using adOpenStatic.try adOpenDynamic. this should allow you to read and write.Also go to help files and look up "Fields" and "recordsets"Hope this will help
25 May 2015 by QuentinEllison19
it's good to have you..i need to update no insert..can you help me with that???con.Close con.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\Users\Public\Documents\SAMPLE.mdb" If con.State = adStateOpen Then con.Close End If con.Open ...
25 May 2015 by OriginalGriff
First thing: check your data.Because you don't list the columns you are trying to INSERT into, Access assumes that you want to insert data starting from the first column - so if you have an automatic ID column at the beginning - and it's very common - the INSERT will fail, because you aren't...
25 May 2015 by QuentinEllison19
hey...hi!!!actually the thing is that i'm new to vb and i'm working on 1 project..just for fun.n i am stuck..means i can't upload means edit the access database with vb6.0here is the thing rec.Open "insert into Payment values ('" & Combo1.Text & "','" & txtTa.Text & "','" &...
15 Apr 2015 by Chris Jorna
Communication Library Files - NetTools | IsSameSubnet
4 Apr 2015 by serkanguncan
web browser, type the password and user name is incorrect error of the form closes. input button on the form are not how I should write an error code?Dim Username, Password As String Username = TextBox3.Text Password = TextBox4.Text ...
4 Apr 2015 by BacchusBeale
You could make/host an error HTML page and redirect (Navigate) to there when there's an error.
1 Apr 2015 by serkanguncan
Please click on the pictureClick for sample picturestopic = translate.google.com clicks I added one form LinkLabel LinkLabel1.Text = WebBrowser1.Document.GetElementById("spelling-correction").InnerTextI do not have click here
31 Mar 2015 by AnotherKen
Maybe this will help? Mouse and Keyboard Tracking and Simulator[^]
17 Feb 2015 by Harindra Shivam
HiMy Application is built in MS Access. Now I want do the code coverage for the application. so is there any tool present to find the code coverage for VBA application ????
6 Feb 2015 by bilalali
Hello Everyone I want making the button if click the button show the output file who I worked in This Example
5 Feb 2015 by RAFAH SAMIH
I want to determine the size of header packet in mpeg4 it always begin with 00-00-94-08 the first packet in frame 00-00-A8-08 the second packet 00-00-b7-08 the the last packet is the packet have only 4 bytes ?
30 Dec 2014 by okanarslan20
Hi guys, i want you tou ask question :) for my application i need to know how to i use htmlagilitypack so i want to get temprature data from tihs url(https://www.google.com.tr/webhp?hl=en&tab=ww&gfe_rd=cr&ei=UrWiVJGeDKuz8wf1moCQBA#hl=en&q=weather+Ankara) but the error "object reference not set...
28 Dec 2014 by Pritam Deshmukh
This tip elaborates few useful tricks and shortcuts of VS 2013 mainly for professional edition (You can find them with Ultimate version too).
13 Dec 2014 by Zoltán Zörgő
This is not a "quick answers" kind of question. It seems, that you haven't tried anything on your own. This is now how it works here, we won't do your job. But here is some guidance:1) VS Express has no Windows Service tempalte. SharpDevelop has. But VS is more convenient to use than SD....
13 Dec 2014 by Rockford Sol
HelloI am looking for a solution to my little problem. I have various windows applications, all applications. I want to have a common windows service to provide some basic support to all these applications.I am new to Windows Services, but I think a windows web service is solution to my...
4 Dec 2014 by Dave Kreskowiak
OS hooks are not going to do it.What you're describing is a proxy server. All requests go through the proxy and it can do whatever it wants with the URL requested, including count how many times it's visited.A proxy is just about the only thing that's going to work with all...
4 Dec 2014 by Y625
VB.NET code that will count the time you've been online at a particular websiteIs it possible?I don't know where to startHELP PLEASE
1 Dec 2014 by DamithSL
try like below Dim SumOfTotalCosts As Double = lbTotalCost.Items.Cast(Of Double)().Sum()
1 Dec 2014 by Member 11278242
Friend.....i think you use new verbs (Hello,the, to ,...etc).which have no identity into the visual studio..so if you want to add these words..you hv to create a new collom nd write a new code .. LYK..lbloutput.tet="txthello.text+ +txtfirstname.text+ +txtlast.text";