|
41-60 of 70
Previous
Next |
|
ExplodeForm - Showing a form with an explosion effect
by Marco Bellinaso
Show a form with an explosion effect.
the numSteps parameter is the number of steps to increase the form size from 0 to the original size
the stepDuration argument is the number of milliseconds between each step
Example:
Private Sub Form1_Activated(...) Handles MyBase.Activated
|
|
ForceTextBoxNumeric - Force a TextBox control to accept only numeric digits
by Marco Bellinaso
Force a TextBox control to accept only numeric digits
Cancel the effect by passing Force = False
Note that it only accepts positive integer values
|
|
ImplodeForm - Hiding a form with an implosion effect
by Marco Bellinaso
Hiding a form with an implosion effect.
the numSteps parameter is the number of steps to decrease the form size from the current size to 0
the stepDuration argument is the number of milliseconds between each step
Example:
Private Sub Form1_Closing(...) Handles MyBase.Closing
|
|
MoveListboxItem - Moving an item of a listbox to another index
by Marco Bellinaso
Moves an item of a listbox to another index
If FROMINDEX = -1 then it moves the current highlighted item
Example:
move up the selected item
MoveListboxItem(ListBox1, -1, ListBox1.SelectedIndex - 1)
move down the selected item
MoveListboxItem(ListBox1, -1, ListBox1.SelectedIndex + 1)
|
|
CountCheckedNodes - Retrieving the number of checked nodes in a treeview
by Marco Bellinaso
Return the number of checked nodes in the specified tree
|
|
Adding an image as an embedded resource, and loading it from code
by Marco Bellinaso
To add an image as an embedded resource in a Windows Forms application, add the image file to the project with Project | Add Existing Item. Then select the file in the Solution Explorer, go to the Properties Window, and set its Build Action property to Embedded Resource. At ...
|
|
Creating multiline tooltips
by Marco Bellinaso
In VB6 there was no easy way to create multiline tooltips for form controls, you necessarily had to resort to API tricks. And it was probably just not worth the effort. The good news is that doing this is straightforward in VB.NET! First add a Tooltip Provider control on the form to add the ...
|
|
Using multiple fields as value for the DropDownList control's items
by Audrey Peters
Being an avid Access Programmer I have been frustrated with the limitation of VB DropDownLists to using only 1 field as the value. I found a way to simulate/work around this behavior with concatenation of several database fields at the query level to be my columns(i.e. Select KeyId1 + '~' + ...
|
|
A cheap way to display files and hex data
by Francesco Balena
The .NET framework includes a ByteViewer control, that you can use on your own forms to display data stored in a Byte array or in a file. The ByteViewer control can't be added to the control Toolbox, though, so you must instantiate it through code only.
' IMPORTANT: this code requires ...
|
|
EnsureNodeIsVisible - Select a TreeView node and ensure it is visible
by Francesco Balena
select a treevide node and ensure it is visible
by expanding all its parent nodes and bringing the node
in the visible portion of the control
|
|
Bind a DataGrid to a DataSet at design-time
by Francesco Balena
Binding a DataGrid - or any other data-aware control - to a DataSet or a DataTable at runtime isn't difficult: you just have to assign the DataTable to the DataGrid's DataSource property, as in:
' DS is the DataSet variable
DataGrid1.DataSource = ds.Tables("Titles")
|
|
Map an enumerated value to a set of OptionButton controls
by Francesco Balena
In VB6 and previous version, displaying an enumerated value in a group of option buttons is quite simple, provided that the option buttons be grouped in a control array. VB.NET doesn't support control arrays, so you can't reuse the same simple coding techniques. However, you can prepare a ...
|
|
Creating owner drawn menu items to simulate a color picker
by Marco Bellinaso
This class does the owner drawing of a MenuItem to draw a color box.
The class inherits from MenuItem, thus the ColorMenuItem objects
can be added to a parent MenuItem or a context menu as you
normally do, and can also be mixed with other MenuItem items
under the same parent item.
|
|
Ensuring that a style is supported by a font family
by Marco Bellinaso
Not all fonts support the same styles. This function takes in
input a font family and a font style, and returns a font style
which is safe for that particular font family, by removing
the styles that are not supported
Example:
GetSafeStyleForFontFamily(richTextBox1.SelectionFont.
|
|
Hiding pages of a TabControl
by Marco Bellinaso
Sometimes you may need to hide or show some pages of a TabControl according to the information you want to show, basing on the currently logged-in user for example (users with low privileges won't be able to get all the information or to change records). To do this, you may attempt to add or ...
|
|
Setting the width of the last column of a ListView when the control is resized
by Marco Bellinaso
When you resize a ListView control (this happens automatically if the ListView is docked to the form, and the user resizes the form), it's nice to have the last column to be resized accordingly to cover the available space. To do this, handle the ListView's Resize control (in .NET any control ...
|
|
Adding styles to the font of the selected text of a RichTextBox
by Marco Bellinaso
Add a style to the selection of a RichTextBox,
without deleting the current styles that may be already
present in the selection or in portions of it
Example: AddFontStyle(richTextBox1, FontStyle.Bold)
|
|
Copying the selected text of a RichTextBox text into the Clipboard
by Marco Bellinaso
Copy the RichTextBox's selected text into the Clipboard
Example: CopyFromRichTextBox (richTextBox1)
|
|
Pasting the text in the Clipboard into a RichTextBox
by Marco Bellinaso
Paste the text currently in the Clipboard into the specified RichTextBox
Example: PasteIntoRichTextBox (richTextBox1)
|
|
Setting the font size of the selected text of a RichTextBox
by Marco Bellinaso
Set the specified font size to the selection of a RichTextBox
Example: SetFontSize(richTextBox1, 16)
|
|
41-60 of 70
Previous
Next |