Save Forms’ Size and Location at Run Time
You’ve noticed how some apps display forms and toolboxes in the same location and size as when you last closed them. Here’s some simple code that gives your VB app
You’ve noticed how some apps display forms and toolboxes in the same location and size as when you last closed them. Here’s some simple code that gives your VB app
Most of us have a routine we call to autohighlight the entire contents of a textbox when it receives focus. And most of us type the name of the textbox
Use this fast function to test for the occurrence of nonalphanumeric characters in a string: Private Declare Function StrSpn Lib “SHLWAPI” Alias _ “StrSpnW” (ByVal psz As Long, ByVal pszSet
Sometimes you need to display information longer than the biggest textbox or label control you can have onscreen. I’ve written a routine that displays a textbox’s or label’s contents in
People’s names come in many separate parts, some of which might not be present or known. The hassle begins when you’re dealing with a storage system?database or otherwise?where the parts
In a production application, every time you want to access a file for reading or writing, you must retrieve a free handle using the FreeFile() function to ensure you don’t
If you often write complex string-parsing and manipulation algorithms, the last thing you want is to add more checks to ensure your string positions are not negative. Avoid the hassle
Most VB programmers must display a form centered on a screen. You can do this in a variety of ways, but most ignore aspects of the environment such as the
If you’re faced with a string that needs to have certain characters removed from it, use the Replace() function to make the problem more manageable. For instance, use this code
Use this function to determine whether a string represents a valid time: Public Function IsTime(sTimeArg As String) As Boolean IsTime = IsDate(Format(Date, “short date”) & _ ” ” & sTimeArg)End
When you write a screen saver in C and the Windows SDK, a static library (SCRNSAVE.lib) allows you to create custom dialogs to change and request the password. But in
The Trim function has a serious shortcoming: It handles only space characters?not all the usual white spaces such as tabs, carriage returns, and line feeds. Instead of the standard Trim
In a large app, or even a small one, you can use Property Let and Property Get to make sure necessary variables and subsystems are initialized. This code is from
When VB’s MsgBox function doesn’t provide everything you need, you have to create a message-box Related Posts What Are Effective Methods for Handling Large Data Sets?The Art of AI-Generated Meeting
Handling multiple command-line arguments has always been ugly in VB, especially when some of the arguments are quoted because they contain characters such as spaces. For example, if you want
You can move controls using Ctrl with the arrow keys, and you can change control size using Shift with the arrow keys. The controls move or resize according to the
When the NodeCheck event triggers, you receive as a parameter the node that was checked. Say you need to do some validation and uncheck the node when there’s an error.
Some forms are merely dialog boxes that show something to the user and sometimes get something in return. For example, you might have to create a form that displays a
A treeview control helps users navigate a large site because they can expand and collapse nodes to keep the view manageable. A good example is the Microsoft Developer Network Online
Question: Is there an easy function to get the Julian (Ordinal) date of a date? For example 015 from 01/15/2000. Answer: Try subtracting December 31st of the previous year from
Question: I recently rewrote my entire Web site using frames and VBScript to load the appropriate pages into the proper frame. My Web site looked fine in Internet Explorer, but
Question: To initialize a pointer after deleting it, should I assign a NULL to it or zero? Are they the same in C++? I know strictly speaking, I should assign
Question: How does Web development with Visual Basic 6.0 and Visual InterDev 6.0 differ? Which tool is better for Web development and why? Answer: Both products can help you arrive
Question: We are in the process of putting up two service portals, which may have business-to-consumer (B2C) transactions. We are confused as to which scripting language we should use. We
A question I seem to answer a lot comes from people trying to pass information through a query string. While Internet Explorer seems to be more forgiving and allows most
Question: Can you recommend a book on writing cross-browser DHTML? Answer: What book you should get depends on where you are now. If you’ve never touched JavaScript before, I recommend
Question: I have the need to monitor a mailbox. The mailbox is located on a local server, but the person accessing it is in another country. The person who needs
Question: Right now we have Exchange set to dial up an ISP and retrieve our mail. We are getting a direct connection to the Internet and I want to host
Question: Is it possible to dynamically sort a listbox (a select box with multiple rows)? Let’s say I want to sort the listbox according to different categories. Answer: Here’s how
Question: My page has two frames. The left-side frame has a tree and depending on what the user clicks, I set the location for the right-side frame. My problem is