Tips And Links






1.23/5 (12 votes)
Mar 22, 2006
4 min read

41539
This article shows some useful tips & links for VB.Net.
Introduction
There are many useful tips & links we can find on VB.Net forum, but we miss them day by day. It is very difficult to retrieve them. My effort is to keep those tips forever. I have included new tips and answers that I provided to VB.Net forum.
Tips & Links - Index
Forms |
3. What Are The Codes For Custom Minimize & Maximize Buttons 4. How To Create Always On Top Form |
File Handling |
Graphics Handling |
Others |
7. What Are The Conversion Functions In VB.Net 12. How To Get Day Of The Week
|
Red & Green - Tips Blue & Purple - Links
Tips & Links
1. | How To Open A File | File Handling |
You can use this code to open a file with its associated application System.Diagnostics.Process.Start(Filename) |
2. | How To Use Flash In VB.Net | Graphics Handelling |
An Example:
Flash MX |
3. | What Are The Codes For Custom Minimize & Maximize Buttons | Forms |
Me.WindowState = FormWindowState.Minimized Me.WindowState = FormWindowState.Maximized |
4. | How To Create Always On Top Form | Forms |
Simple, set form's Topmost property to true |
5. | How To Create A Form With A Transparent Background | Forms |
Set form's TransparancyKey property to forms background color, or you can create ghostly forms by changing the Opaque property (0 -100) |
6. | How To Use Splitters | Controls [ Splitters ] |
An Example:
1. Draw a panel on the form 2. Draw a textbox on the panel ( TextBox1.width is ( 1/2 Panel1.width ) ) 3. Set TexBox1's Dock property to Left 4. Draw a splitter on the panel and set its Dock property to Left 5. Run Your Application 6. Now resize your TextBox1 by dragging the splitter |
7. | What Are The Conversion Functions In Visual Basic | Others |
CBool : Converts to Bool CByte : Converts to Byte CChar : Converts to Char CDate : Converts to Date CDbl : Converts to Double CDec : Converts to Decimal CInt : Converts to Int CLng : Converts to Long CObj : Converts to Object CShort : Converts to Short CSng : Converts to Single CStr : Converts to String |
8. | How To Print the Content of a RichTextBox | Controls [ RichTextBox ] |
http://support.microsoft.com/default.aspx?scid=kb;en-us;811401 |
9. | Find And Replace Method For RichTextBox | Controls [ RichTextBox ] |
10. | How To Handle Multiple Button Clicks | Controls [ Buttons ] |
If You have two or more buttons you can handle them like this
Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, _ Button2.Click,Button3.Click If sender Is Button1 Then action1 ElseIf sender Is Button2 Then action2 ElseIf sender Is Button3 Then action3 End If End Sub |
11. | How To Insert An Image Into A Picture Box At Run Time | Graphics Handling |
PictureBox1.Image = Image.FromFile(filename) |
12. | How To get Day Of The Week | Others |
'If Date is 24 March 2006
Dim strDayOfTheWeek As String
Dim intDayOfTheWeek As Integer
strDayOfTheWeek = Now.DayOfWeek.ToString ' returns FridayintDayOfTheWeek = Now.DayOfWeek ' returns 5 |
13. | How To Create A New Directory | File Handling |
Imports System.IO . . Directory.CreateDirectory(Path) 'Example Directory.CreateDirectory( "C:\myDirectory" ) |
14. | How To Create A Dialog | Forms |
VB.Net 2003 1. Create a new form (Form2) 2. Create two buttons 3. Set these properties Button1 : Name = OK_Button , Caption = OK Button2 : Name = Cancel_Button , Caption = Cancel Form2 : Name = Dialog1 , FormBorderStyle = FixedDialog , MazimizeBox = False , MinimizeBox = False , AcceptButton = OK_Button , CancelButton = Cancel_Button
VB.Net 2005 Click Add New Items button on the standard toolbar Select Dialog and Click Add
Now You Can Use Your Dialog in Form1 Dim myDialog As New Dialog1 If myDialog.ShowDialog = Windows.Forms.DialogResult.OK Thenaction End If
|