Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Search the Tips

Forms - Page 2

21-40 of 390     Previous     Next
Extended user interface for combo boxes
by Francesco Balena
Apart from the different kind of combo boxes you can obtain by manipulating the Style property, another feature is made available by Windows when dealing with combo box controls, the so-called extended user interface. With standard combo box controls, the list portion stays invisible until the ...
Smart Tab key processing in multiline TextBox controls
by Francesco Balena
The only way for a Tab key to insert a tab character in a multiline text box is that the text box is the only control on the form, or at least the only control whose TabStop property is set to True. Otherwise, pressing the Tab key you simply move the focus to another control on the form.
Use Refresh, not DoEvents
by Francesco Balena
The DoEvent statement should be used only to give other portions of your program to be reactive to the end user's actions. Instead, many VB developers use it to force a repaint of a form or some of its controls. This means adding a lot of overhead to your code, which you can avoid by using the ...
Making a form appear as if it is disabled
by Francesco Balena
By changing the WS_CHILD style bit of a window, you can make it appear as if it is disabled, even if the form is fully active and functional. These are the statements you need: Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex ...
Retrieve a Parent Directory From a Path
by Andreas Hillqvist
You can retrieve the parent directory from a path by identifying the first and last backslash. The start position for the first backslash should be 3 in order for it to handle UNC paths. By ...
DrawBorder - Draw a raised/bump/etched/sunken border
by Marco Bellinaso
draw a raised/bump/etched/sunken border at given coordinates
Cut, copy, and paste using API functions
by Francesco Balena
Copying and pasting text and images programmatically isn't difficult at all, using the methods of the Clipboard object. However, implementing a generic Edit menu that copies and pastes the highlighted contents of whatever control is the selected control is often cumberson. For example, ...
Get a reference to a form given its name
by Francesco Balena
In some cases you might want to activate a form given its name, but VB doesn't let you do it directly. However, it is easy to create a function that does it by iterating over all the forms in the current project: ' retrieve a reference to a form given its name ' if there are multiple ...
Unload a form with shrinking effect
by Francesco Balena
A simple way to add some pizazz to your forms is by minimizing them and then closing them, instead of making them disapper istantaneously. Just try this code: Private Sub Form_Unload(Cancel As Integer) Me.WindowState = vbMinimized End Sub
Save and reload form settings from system registry
by Francesco Balena
You can put VB's registry functions to good use by creating a few reusable routines that save, reload, and delete size and state of a form in your program. ' Save form settings Function SaveFormSettings(ByVal AppName As String, frm As Object) SaveSetting AppName, frm.Name, ...
SplitSubMenu - Split a submenu with vertical bars
by Francesco Balena
Split a menu with one or more vertical lines Return True if successful HWND is the handle of the parent window ITEMSINSECTION is the max number of items in each section created by the vertical lines MENUPOS is a list of arguments that point to the menu item to be split the first argument ...
Using the PaintPicture Method
by Andreas Hillqvist
It is possible to use the PaintPicture Method of the PictureBox or Form by entering different dimensions for source height/width and destination dimensions.
Read and modify a TextBox control's formatting rectangle
by Francesco Balena
By sending appropriate messages to a multi-line TextBox control you can read and modify its formatting rectangle - that is, the inner portion of the control where the user can type. Modifying the size and position of this area can be useful, for example, to leave a left margin where you can add ...
ComboBoxGetDroppedControlRect - Get the size of a ComboBox dropped rectangle
by Francesco Balena
Return the size and position of the drop-down list rectangle of a ComboBox control.
Ensure that a TextBox caret is visible
by Francesco Balena
Setting a multiline TextBox's SelStart property doesn't ensure that the insertion point (the caret) is visible. You can achieve this by sending the control an appropriate message: Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As ...
Set tab stop positions for a multiline TextBox control
by Francesco Balena
By default, multiline TextBox controls insert a tab stop position every 8 characters; in other words, if you press the Ctrl+Tab key while the focus is inside a multiline TextBox control, the caret advances to position 8,16,24, etc. (If the TextBox is the only control on the form that can ...
TextBoxGetLine - Return a single line in a multiline TextBox control
by Francesco Balena
Return the specified line in a multiline TextBox control.
TextBoxGetLineColumn - Get caret position in a multiline TextBox control
by Francesco Balena
Get the line/column coordinates of a given character (both are zero-based). If charIndex is negative, it returns the coordinates of the caret
TextBoxGetLines - Get an array with individual lines in a TextBox control
by Francesco Balena
Return an array with all the lines in the control. If the second optional argument is True, the hard CR-LFs are preserved (hard CR-LFs are those inserted by the user, soft CRLFs are those inserted automatically to wrap long lines)
TextBoxScroll - Programmatically scroll a multi-line TextBox control
by Francesco Balena
Scroll the contents of the control. Positive values scroll left and up, negative values scroll right and down. IMPORTANT: you can only scroll TextBox control to which the corresponding scrollbar (horizontal or vertical) is associated
21-40 of 390     Previous     Next
Thanks for your registration, follow us on our social networks to keep up-to-date