Click here to Skip to main content
15,881,898 members
Everything / Programming Languages / Visual Basic 12

Visual Basic 12

VB12

Great Reads

by Mr. xieguigang 谢桂纲
How to build my own 3D graphics engine from ZERO step by step
by Mr. xieguigang 谢桂纲
The ShellScript is originally developed for the debugging of my "genome-in-code" virtual cell simulation engine, but now it becomes a script language for a .Net program.
by William Costa Rodrigues
This article explains an easy method to download and update your WinForms application
by a_pess
Image File Format

Latest Articles

by William Costa Rodrigues
This article explains an easy method to download and update your WinForms application
by Mr. xieguigang 谢桂纲
How to build my own 3D graphics engine from ZERO step by step
by Mahesh Rajaram Shinde
This project is designed for addressing SQL Server Script deployment on multiple servers and databases.
by David Vanson
Generate you own barcodes for your business, Promotional items or to share links with friends.

All Articles

Sort by Score

Visual Basic 12 

1 Feb 2017 by Mr. xieguigang 谢桂纲
How to build my own 3D graphics engine from ZERO step by step
14 Oct 2014 by Mr. xieguigang 谢桂纲
The ShellScript is originally developed for the debugging of my "genome-in-code" virtual cell simulation engine, but now it becomes a script language for a .Net program.
26 Sep 2019 by William Costa Rodrigues
This article explains an easy method to download and update your WinForms application
15 May 2014 by a_pess
Image File Format
11 Jul 2014 by Richard MacCutchan
The declaration:Private Declare Function SendCommand Lib "pf500.dll" Alias "WriteCommand" (ByVal porthnd As Long, ByVal seq As Byte, ByVal vlez As String, ByVal izlez As Long, ByVal stats As Long) As Integeris using the name SendCommand to refer to the function WriteCommand in the DLL. In...
22 Jul 2014 by Rocky R. Fernandes
Install Rails 4 and MySQL Server on Windows 7/8
4 May 2015 by Sascha Lefèvre
Some barcode types (e.g. Code 39, Code 128, Interleaved 2 of 5) can be "generated" simply by using a font that displays the appropriate bars instead of digits or letters. So you wouldn't need any special component, just some code that is able to print text and then select the barcode font...
21 May 2015 by Anele 'Mashy' Mbanga
Exploring the source code behind the offline CodeProject article writer CodeProject.Show.
16 Sep 2019 by Richard MacCutchan
You most likely need to upgrade to the latest Access DB engine: Download Microsoft Access Database Engine 2016 Redistributable from Official Microsoft Download Center[^].
2 Jun 2014 by a_pess
Check image is upside down in VisualBasic.NET
6 Jun 2014 by OriginalGriff
Um. The fragment you show is trivial - and just a fragment. So I'll show you how to do the bits you show, and let you get on with it.VB:Dim ret As Long ' return value from OAPI callsC#:long ret; // return value from OAPI callsSee what I mean? Trivial...VB:Set myEtabs =...
23 Sep 2014 by PIEBALDconsult
How about something like while stack.Count > 0 ?
19 Oct 2014 by Sheepings
For a start, you are using the wrong control if you want to get a list of all files in a directory based on a folder path. (Unless you want specifically select these files only).You are using the OpenFileDialog when you would be better to use the OpenFolderDialog. I would only be using the...
26 Mar 2015 by Sergey Alexandrovich Kryukov
Yes. Look how it works. Microsoft wants everyone to reference some assemblies (in .NET, the key unit is assembly, "DLL" is just one of modules), use some types from them, and all works right away. For this purpose, by default, a separate output file is created for every assembly, per...
16 Apr 2015 by Chris Jorna
Communication Library Files - LMS5lib | Connection and structure
12 Nov 2015 by Dave Kreskowiak
You do NOT want to attach LEDs directly to the parallel port. There are projects out there that will tell you you can get away with it, but you risk blowing up the port if you're not careful and with some ports, it won't work at all.It's possible to do but I recommended against it. See this...
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.
16 Sep 2019 by Maciej Los
In addition to solution #1 by Richard MacCutchan[^] you'll need to change connection string. See: Access connection strings - ConnectionStrings.com[^]
30 Sep 2019 by OriginalGriff
We can't help you based on that info: we have no idea what the base query you are appending to is, and that's probably relevant. I'd start by using the debugger: find out what exactly is in sqlQry when you create the SqlDataAdapter, and what exactly is in each parameter you pass over. At a...
4 Oct 2019 by OriginalGriff
Don't use Access as a multiuser DB - while you can do it, it's not a good idea and will always give you problems. For a 40 user network, I'd allocate a machine to SQL Server, and use that instead*. SQL Server is designed from multiuser working, and is much, much better at it - especially if your...
17 Jan 2022 by Richard Deeming
If you want to set the header via code, the simplest option is to add another parameter, pass the required title in that parameter, and set the text box's text to that parameter. Otherwise, you could use an expression for the text box parameter,...
20 Jun 2022 by OriginalGriff
That's the least of your problems ... so little code, so many problems. Let's start with the one you have noticed, because it's one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most...
26 Mar 2023 by Graeme_Grant
If you want to pass the event from the UserControl to a parent container, like a Form, then you need to: 1. expose either a Method to a delegate (a method or function to call from within the UserControl) or 2. add a public Event property to the...
18 May 2014 by a_pess
Demonstrates how to retrieve resources from a .NET Assembly in Visual Basic .NET
21 May 2014 by Maciej Los
Use parametrized query, like this one:UPDATE tbl_CustomerCard SET fld_custPhone = @Phone, fld_ExpireDate = @Exdate WHERE fld_CardNo = @CardNoThen call it using SQLParamterCollection[^] for SQLCommand[^].For further information, please see: How to: Perform Parameterized...
10 Jun 2014 by Thava Rajan
This tip is used to fix a workaround for a bug in double click on checkbox
26 Jun 2014 by Mohibur Rashid
As OP requested, the tip is copied to answer box so that he can acceptyou can just$(selectedObject).remove(); besides if you don't know id you get get id by$(selectedObject).attr('id')
28 Jul 2014 by Sergey Alexandrovich Kryukov
In all versions of .NET starting from v.2.0, this is a correct method: http://msdn.microsoft.com/en-us/library/ms161352%28v=vs.80%29.aspx[^].If you are using some prior version of .NET, 1) migrate to any version starting from 2.0, or, better, 3.5; discontinue support of older version;...
28 Aug 2014 by PhilLenoir
If I understand your requirement correctly, your select clause is flawed. Instead of using 2 subqueries in your where clause, use a join between the two tables in the subquery. Also, you can't embed the object itself in your SQL string, you need to concatenate:SELECT * FROM youtube...
7 Sep 2014 by CPallini
This Wikipedia page could be your starting point: "Bin packing problem"[^].
19 Sep 2014 by Shekhar Pankaj
Using Web Configs Key Value pair in classical Asp pages
15 Oct 2014 by NaibedyaKar
I think the best solution for this will be private void CheckUncheck() { foreach (CheckBox chk in groupBox1.Controls) { chk.Checked = chk.Checked == false; } }
24 Oct 2014 by Sheepings
Hi, here is a another solution for you which works perfectly. So you can also mark this as a solution too. If you have any questions, please post your questions under my solution and I will get back to you when I have some free time. :)As you requested alterations for the checkboxes...
24 Oct 2014 by OriginalGriff
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...A very quick search using your subject line as the search term gave over one million hits: "vb online registration system"[^]In future, please try to do at least basic...
5 Nov 2014 by Richard Deeming
Assuming you're using .NET 4.5, you can use the built-in ZipFile class[^].Add a reference to the System.IO.Compression.FileSystem assembly, and Import the System.IO.Compression namespace. Then use:Dim path As String = IO.Directory.GetCurrentDirectory()Dim zipPath As String =...
16 Nov 2014 by dehumanate
Ok, let's see if, without using an IDE or a VB compiler, we can find some bugs!Firstly, let's simplify that huge loop - notice how ever block after each If statement checking intCount is the same? We can refactor this to use the loop effectively:Private Sub btnVerify_Click(sender As...
26 Nov 2014 by King Fisher
Refer this :http://msdn.microsoft.com/en-us/library/vstudio/cc148994%28v=vs.100%29.aspx[^]
12 Dec 2014 by Sergey Alexandrovich Kryukov
Please see my comments to the question. Again, you are approaching it in a wrong way.When I replied that using big text files is a bad thing and asked about your goals, you did not really explain them, but you mentioned that "some sort of software" which probably doesn't give you a choice....
6 Jan 2015 by Mehdi Gholam
The best programming language is the one that you use and are comfortable with.There is very very little you can do in c# or visual basic.net that you can't do in the other.
6 Jan 2015 by King Fisher
complete comparison of both:Complete Comparison for VB.NET and C#[^]Don't skip any lines....
9 Mar 2015 by manchanx
The ConnectionString where you specify the Database that should be used is a property of the Connection-Class. Just create a Connection-Object and then set the user-specific ConnectionString before using the Connection.edit:An excerpt from my database-access-class, maybe it...
19 Mar 2015 by Rahul121616
Following is the Jquery code for the change event whenever the file uploaded or changed. var document1FileUpload = $('#Document1FileUpload');var fileNameTextBox1= $('#fileNameTextBox1');document1FileUpload.die(); document1FileUpload.live('change', function () { ...
21 May 2015 by Sergey Alexandrovich Kryukov
First, you can choose one from the available borders: https://msdn.microsoft.com/en-us/library/system.windows.forms.form.formborderstyle%28v=vs.110%29.aspx[^].If this is not enough, you can use borderless form and draw a border in the client area using overridden OnPaint method. To avoid...
20 Jul 2015 by Wendelius
If the idea is to attach the database, you should use a different connection string. Try:Dim objConnection As SqlConnection = New SqlConnection("server= " & "DARBYSDEN\SQLEXPRESS14; " & "attachbbfilename=D:\Data Files\DVD_List.mdf;database=mydbname;" & ...
12 Aug 2015 by OriginalGriff
"yes i am using database (access 2007)"So, just use a query:Dim dtStart As DateTime = dtpStartDate.ValueDim dtEnd As DateTime = dtpEndDate.ValueUsing cmd As New OleDbCommand("SELECT * FROM MyTable WHERE MyDateColumn BETWEEN @ST AND @EN", con) cmd.Parameters.AddWithValue("@ST",...
10 Sep 2015 by Jim Meadors
look up SendKeys and see if there is a way you can make it work with your button to activate your F5 key. You may need to play around with getting the program you want it applied to in Focus before it will work...
15 Oct 2015 by Palash Mondal_
Since the ShowProgress function is already attached to the submit button click like:$('form').live("submit", function () { ShowProgress();});You can just click the submit button again to trigger it like:-$("[id*=ddlCountries]").change(function() { ...
13 Dec 2015 by Thomas Daniels
To restart a Windows Forms application, use Application.Restart[^]:Application.Restart()
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...
22 Jun 2016 by Dave Kreskowiak
Most monitors don't support being turned off completely by this command. Doing so normally just puts the monitor to sleep, not power it off. There is no way for you to get around this behavior and no documentation that I know of to tell you which monitors support this and which don't.
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...
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...
11 Jan 2017 by Dave Kreskowiak
The problem is that you're app doesn't store the information in a data model. You're using a display/edit control as your data container and that's not good practice. It's also what's making it very difficult for you to do this comparison.Create a data model in your code to store the data....
15 May 2017 by Patrice T
Never build an SQL query by concatenating with user inputs, it is named "SQL injection", it is dangerous for your database and error prone. A single quote in a name and your program crash. If a user input like "Brian O'Conner" can crash your app, it is an SQL injection vulnerability. SQL...
1 Jun 2017 by Richard MacCutchan
It sounds like you are talking about a Wizard Control. See vb.net wizard control - Google Search[^].
16 Jun 2017 by RickZeeland
This looks a bit dated, but might be of use: Visual Basic SLOT MACHINE[^] And another one: Creating a Video Slot game with VB.NET[^]
24 Oct 2017 by CHill60
Have you tried debugging? Here is a guide to how to do that Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^] Why redisplay the form (that is probably what is affecting your focus - try removing : Me.Show()
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...
23 Nov 2017 by CPallini
You should use arrays of controls (e.g. txts(5) instead of txt5s) and arithmetic relations, in order to reduce all the Case stuff to If cur_years
4 Jan 2018 by OriginalGriff
Look at the error message: Failed to convert parameter value from a string to a int32 It's saying "I expected an integer here, and you gave me a string that doesn't contain an integer value." So look at cmd using the debugger and see exactly what you are passing as the command - and since...
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...
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) _ ...
19 Apr 2018 by OriginalGriff
So many bad ideas in such a short piece of code... Don't do it like that! Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead. When you concatenate...
2 Apr 2019 by Leo Chapiro
I would implement the TextChange-Event on the both of the textbox1 and textbox2 like this: Try textboxsum.Text = Convert.toInt32(textbox1.Text) + Convert.toInt32(textbox2.Text) Catch ...
23 Sep 2019 by OriginalGriff
Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Always use Parameterized queries instead. When you concatenate strings, you cause problems because SQL receives commands like:...
30 Sep 2019 by Maciej Los
My best guess is... If you're adding condition to your query, you need to add parameters too: SQLText.Text = sqlQry Dim ds As DataSet = New DataSet Dim da As New SqlDataAdapter(sqlQRY, cnnOLEDB) Dim cb As SqlCommandBuilder = New SqlCommandBuilder(da) ...
7 Oct 2019 by OriginalGriff
Quote: taking into consideration that Excel.xls file has no Empty records Are you sure? Most Excel files have more empty records than non-empty: all that lovely whitespace at teh bottom! Since you don't specify any limits on what rows are returned: MyCommand = New...
25 Jan 2020 by Wendelius
Don't do like this. Never ever concatenate values directly to an SQL statament. It leaves you open to SQL injection. Instead, use MySqlParameter Class[^] Another thing that never must be done, don't store the password as plain text in the database. To do this correctly, see Password Storage:...
25 Jan 2020 by Richard MacCutchan
First point, do not use string concatenation to create SQL statements, it leaves your system vulnerable to SQL injection. Use parameterised queries always. Second point, do not store passwords in clear text, use salted hash values always. See Secure Password Authentication Explained Simply[^] ...
25 Jan 2020 by Patrice T
query = "Select * from login where Username= '" & txtuser.Text & "' AND Password = '" & txtpass.Text & "'" Not necessary a solution to your question, but another problem you have. Never build an SQL query by concatenating strings. Sooner or later, you will do it with user inputs, and this opens...
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...
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...
8 Apr 2021 by Maciej Los
I'm not sure what you want to achieve, but... You should use proper .NET data types and functions. See: Dim Thisdate As DateTime = New DateTime(2021, 7, 8) Dim JanuaryFirst As DateTime = New DateTime(Thisdate.Year, 1, 1) Dim tdiff As TimeSpan...
24 Jun 2021 by Maciej Los
I'd strongly recommend to read this: Where Should I Store My Data?[^] The way to get user documents folder is to use: Environment.GetFolderPath Method (System) | Microsoft Docs[^]
19 Aug 2021 by OriginalGriff
The way I'd do it is to create three projects: the two EXEs and a DLL which contains the "common stuff". Create that as a Class Library and add a reference to the project in both EXE projects. Then all you have to do is add the appropriate...
25 Aug 2021 by Dave Kreskowiak
Keywords - Visual Basic | Microsoft Docs[^] FORTRAN 77 doesn't have any reserved words, but that doesn't mean using any keywords is a good idea.
4 Apr 2022 by OriginalGriff
A better way would be to use a loop: For i As Integer = 0 To 14 DGV.Rows(i).Cells(2).Value = i + 1 Next But ... since indexes are zero based, the column you want to index is probably 1, not 2
8 Jun 2022 by OriginalGriff
Look at the Math.Min operator: mostYouCanHave = Math.Min(qtyInStock, qtyOrdered)
21 Jun 2022 by Richard MacCutchan
Look at the code: Dim conn As New OleDb.OleDbConnection Dim dbProvider As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;" Dim dbSource As String = "Data Source = C:\Users\Sam\Documents\User Accounts.mdb" Dim adapter As...
26 Dec 2022 by OriginalGriff
Do yourself a favour, and don't use strings at all. Create a Card class, which has a Value and a Suit and then a Deck class which contains a List of Card objects. Populate the Deck with all 52 possible cards, and then write a Shuffle method that...
26 Dec 2022 by Graeme_Grant
As OriginalGriff pointed out, it's much easier to use objects to represent The deck, cards, etc. If you think about it, it is no different from the actual objects in real life. A card has a suit and value. A deck has a number of cards. A dealer...
4 Jul 2023 by OriginalGriff
As the others have said, that many textboxes on a single form is a pretty poor UI design: it's difficult to manage, difficult to code for, and difficult for a user to process. It also probably looks very ugly! :D If you need to present or...
13 Nov 2017 by Παλαβρατζής Βασίλης
Hello everyone!! I have a serial device which sends me data at the baudrate of 38400 and i get it like this "?@D00014C000 000".I can see data comes in on a ritchtextbox but what im trying to do is to use some characters from the string in a list box. For example i want characters "14C" appears...
13 Nov 2017 by CPallini
Quote: Me.rtbReceived.Text &= [text] Dim fine As String = Mid([text], 7, 3) Dim list As Integer = ListBox3.Items.Add(fine) The problem is you are adding to the list while the text box string might be still incomplete (you are building it incrementally). You have to...
25 Oct 2023 by OriginalGriff
They don't have "name variables" because they are created at run time (when your app is executing) rather than at compile time - so the only time anyone knows how many of them there are is long after all the variable names have been assigned. So...
6 Apr 2014 by Peter Leow
In For loop, it is 3-in-1:1. declaration and initialization of dblRate As Double = 0.052. condition check dblRate
13 May 2014 by Member 10815549
I want to make some changes to IE settings of many PCs to be able to open a tool which willl be used by all users using the systems.. Since same settings are to be applied to different systems. I want to automate it using vb script . Settings are :1.Go to internet Options--...
18 May 2014 by SamFad
Please I need urgent assistant in dynamically generating a report at run-time from two or more tables within a database using crystal report.If I use a single table I don't have issues but trying to generate from two or more tables is the challenge I have.Below are code snippet of how I...
21 May 2014 by Vipin Sharma
i am developing an app ,the problem is when i update a form the query runs properly and it update the other field but the date field wont update ,it set to its minimum value 1847 something like this. this is my code . Dim dt As Date dt = dtp_Expired.Value ...
22 May 2014 by Keerthi Kumar(Andar)
Hi experts,I want to view my panel control in print preview view.that panel contains a grid view including some in template field i don want that images in pdfis there any way to view the panel as print previewthanks in advance(Keerthi Kumar)
22 May 2014 by Rao Lokesh
use javascript methodfunction FunctionName (s,e){////Make visible false those controls you don't want to see in print Window.Print();////Make Visible true those control again }For Example :-function printdata() { imgPrint.SetVisible(false); ...
22 May 2014 by a_pess
ThreadSafe Generic List
22 May 2014 by Sidharth R
how to edit numerical values in a paragraph without editing any character content??i'm using vb form and mssql databasei have a paragraph content including some numeric values date and character.i need to take the entire string and need to edit the numeric numbers in the string via...
23 May 2014 by Manikandan10
I wrote the code for only extracting the numbers. Public Class Number Public Value As Integer, Position As Integer Public Sub New(v As Integer, p As Integer) Value = v Position = p End Sub End Class Public Shared Function...
24 May 2014 by Kailashkumar Raghvani
i have an panel control and change back background image Using Scroll in and Scroll out using do while loop
27 May 2014 by Keerthi Kumar(Andar)
Hi experts,I have one grid view am trying to print that grid view using javascript,but the grid contains footer roe and image's in the first column. i want to hide the images and footer row while printing . can any one please help me to solve this issuemay java script is
27 May 2014 by Peter Leow
This may help: Adding & Removing GridView columns in the Print Preview using JavaScript [^]
2 Jun 2014 by OriginalGriff
"Is it possible to retain the value of datetimepicker object to a local variable rather than using a database?"Yes - you can store it in a DateTime and serialize it any way you want, within reason - you don;t have to use a DB:Dim myDate As DateTime = myDateTimePicker.Value "I also want...
3 Jun 2014 by Keerthi Kumar(Andar)
Hi experts,i want to add ajax autocomplete extender in my project that has been created in vb.but service method is not calling. Its not working properly please help me solve this issue.my code is
3 Jun 2014 by DamithSL
change your web method signature as below System.Web.Services.WebMethod()> _Public Shared Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer) As List(Of String)End FunctionAnd you better follow the stems in AJAX...