|
21-40 of 70
Previous
Next |
|
Restrict Users to Launching Only One Instance of an Application
by Vimal Kanth
Use this code to restrict users to launching only one instance of an application.
|
|
Synchronize Color Changes Between Controls in a Windows Form
by Juli Jorgensen
Learn how to bind Windows Forms controls to each other can reduce the code and logic needed to synchronize color changes between controls in a Windows Form.
|
|
Code for Setting Windows Desktop Wallpaper in VB 2005
by Jay Roxe
This code sets the Windows desktop wallpaper to an arbitrary image on the user's local drive. It illustrates use of VB2005 "My" classes, in this case to find the location of the user's My Pictures directory without a lot of coding.
|
|
Determine Whether a Combobox Is Being Loaded
by David Acree
Use the ComboBox Created Property to determine if a combobox is being loaded or not.
|
|
GetSelectedRadioButtonValue - Retrieving the value of the selected RadioButton
by Marco Bellinaso
Return the Tag value of the selected RadioButton from the input array of controls.
This is useful when you have many radio buttons, with a value associated to each one, and want to select the value of the checked option. Instead of writing something like this:
If RadioButton1.Checked Then
|
|
Use GDI to Draw on Top of Other Windows
by Paul Marinescu
|
|
Dragging & dropping files on a form
by Marco Bellinaso
Most document-based applications typically allow to open a document file in two ways: with the Open File menu command / toolbar button, or by dragging and dropping the file from Windows Explorer to the application's window. This works with MS Word, Winzip and many other applications. ...
|
|
Enable a key-skipping mechanism for a TextBox
by Marco Bellinaso
Enable the key-skipping mechanism for the input TextBox and for the input chars
Example: don't process the 'A', 'b' and '0' chars
EnableTextBoxCharSkip(TextBox1, "A"c, "b"c, "0"c)
|
|
GetControlsByTag - Find all the controls with the specified Tag value
by Alberto Falossi
Find all the controls with the specified Tag value
Example:
Dim ctrls() As Control = GetControlsByTag("OK", Me)
Dim ctrl As Control
For Each ctrl In ctrls
Debug.WriteLine(ctrl.Name)
Next
|
|
GetTextBoxCurrentLine - Determine the current line in a multiline TextBox control
by Marco Bellinaso
Determine the current line in a multiline TextBox control
Example: MessageBox.Show(GetTextBoxCurrentLine(TextBox1))
|
|
Don
by Marco Bellinaso
Have you ever tried to change the BorderStyle, HideSelection, MultiLine, ScrollBars, WordWrap and TextAlign properties of a TextBox, or the ComboBox
|
|
FindControl - Retrieving a reference to the control with the specified name
by Marco Bellinaso
Return a reference to the control with the specified name, searched into the specified container and its sub-controls
Note: it requires the GetAllControls function
Example: get a reference to a Label named "lblTest", and set its Text property
DirectCast(FindControl("lblTest", Me), Label).
|
|
InputBox - A .NET replacement for this VB6 function
by Marco Bellinaso
Create an InputBox like the one of VB6. You can define the dialog's title, question and default value.
Example: MessageBox.Show(InputDialog.InputBox("Type your name:", "Test", "Marco"))
|
|
InsertImageIntoRtb - Inserting an image into a RichTextBox
by Marco Bellinaso
Insert an image into a RichTextBox, in the current position
This version takes in input the target RichTextBox and the path of the image to insert
Example: InsertImageIntoRtb(RichTextBox1, "C:\test.jpg")
|
|
Skipping columns when tabbing on a DataGrid
by Marco Bellinaso
It happens quite often that you have a DataGrid with hidden columns (with width = 0), because you need their values but don't want to show them to the user. However, when you tab through the DataGrid's columns, these "hidden" columns are still taken into account in the tab order. This means ...
|
|
GetAllControls - Retrieving all the controls inside a container and its sub-containers
by Marco Bellinaso
Returns an array with all the controls in the specified container control and its child containers
Example:
print the name of all the controls on the form and its child container controls
Dim ctl As Control
For Each ctl In GetAllControls(Me)
Debug.WriteLine(ctl.Name)
Next
|
|
GetValidationSummary - Builds a validation summary for all the controls inside a container
by Marco Bellinaso
Return a validation summary string with all the error messages, if any, of the controls inside the specified container, associated to an ErrorProvider control
Example:
Dim summary As String = ""
display the validation summary for all the controls on the form
summary = GetValid
|
|
GetControlsByType - Retrieving an array of controls of the specified type
by Marco Bellinaso
Returns an array of controls of the specified type, found within the specified parent control (or the form itself).
Note: the search is optionally done recursively, by checking also controls' child controls
Example: get an array with the form's textboxes
Dim textboxes() As TextBox = ...
|
|
ResetControls - Reset the value for the input array of controls
by Marco Bellinaso
Resets the value for the input array of controls, and thier child controls
Example:
- reset all the controls on the form: ResetControls(Me)
- reset specific controls: ResetControls(TextBox1, CheckBox1, GroupBox1)
|
|
GetNodeNestingLevel - Returns the nesting level of a TreeView's Node object
by Marco Bellinaso
Returns the nesting level of a TreeView's Node object
(returns zero for root nodes)
|
|
21-40 of 70
Previous
Next |