|
|
|
|
|
Home | Forums | Visual Basic 6.0 | Games | Web Directory | Software | HTML | Wiki | Blog | Contact |
|
|
|
ActiveX ControlAllenOCX is an ActiveX control that I made to help myself and others with common tasks in Visual Basic. It is the first control that I made. You can read its text file here, or download it here. FExistsWhen you are designing a program that will allow the user to open a file, you will need a way of checking to see if that file exists. Using the Microsoft Common Dialog Control 6.0 (SP3) as well, you can check to see if a file exists with this code:
The .FExists method is used. As you can see, the above code uses If, Then, Else and End If code so that if the file did not exist, a message box will be displayed warning the user that the file specified did not exist. There is a Flag property you can set to stop the Common Dialog control from opening files that do not exist, but for the above example, the Flag property was left at 0. ColConvIf you are designing a program that uses a list of colours that the user can click on to change the colour of another control such as a textbox, the .ColConv method will be useful. When an item in the listbox is clicked on, code will be executed to change the background colour of the textbox:
This code is used:
The .ColConv method returns the number associated with that colour, so the following code will also have created a red background (but code for all colours would need to be added):
GetBigIconThe following code is executed when text is typed into a textbox. When that text is a valid file name, the icon for that file will be displayed in an image box:
When C:\WINDOWS\SYSTEM.INI was typed into the textbox, its icon was displayed in the imagebox:
The .GetSmallIcon method would return the file's small icon. HTML2PTThis function converts simple HTML code to plain text. I.e.:
PT2HTMLThis function converts plain text to HTML code. I.e.:
TopMostThere are times when you will want you application to be displayed above all others even if it is not currently in focus. This is where the .TopMost method comes in. To get your application to do this:
The code for this is again, quite simple:
I hope this page has given you an idea of what the Allen OCX component can do. Have a look at the other ActiveX pages to see how to use them. blog comments powered by Disqus Archived Comments
Martin Allen 1999 - 2011. Last updated Wednesday 10 August 2011 07:19:50 PM +0100. |