AOL is the go-to destination for the latest stories shaping the world and impacting everyone.Visual Basic Programming Tips and Techniques by Peter Aitken. Home Page. x.. and why should you care what he has to say about Visual Basic. Expert Visual Basic programmer, with over 2. Author of over 5. Click here for information about recent books. For many years, Contributing Editor at Visual Developer. Basically Visual, a column on Visual Basic programming. Has written over 1. PC. Magazine, PC Tech Journal, Microsoft Office Solutions, Dev. X, and Turbo Technix. The articles can help a workforce with IT training or individuals with related concerns. Send me e- mail. You can read the full text of past Basically Visual. These were originally published in Visual. Developer magazine. Unfortunately this excellent magazine. May 2. 00. 0, so Column 2. Column 2. 4. Perhaps you will find something that is useful to you. These tips. are all relevant to pre- . NET versions of Visual Basic. The Web. Browser control is a powerful tool useful in many Web- related. In effect, this control provides the browser functionality of Internet. Explorer in a software component that you can incorporate in your projects. In. some applications it is desirable to customize the Web. Browser control's. While some customization is possible through the control's properties. Microsoft has made a tool. Web. Browser customizations, specifically having to. You can disable. context menus, and can disable all or selected accelerator keys. The tool is. called WBCustomizer and is available by downloading WBCustom. Q1. 83/2/3. 5. ASP. WBCustomizer. dll and a sample project. To use the WBCustomizer object, you must register the DLL as follows using. FreeFileSync is a free Open Source software that helps you synchronize files and synchronize folders for Windows, Linux and Mac OS X. It is designed to save your time. Create awesome web slideshows in second without a line of code. You're in 'Safe' Hands Sorry, we couldn't resist the pun – but it's true! For over 20 years, FME has been trusted by tens of thousands of. OpenEXR is a high dynamic-range (HDR) image file format developed by Industrial Light & Magic for use in computer imaging applications. Run command: regsvr. Use the full path to the DLL file as required. In your Visual Basic project the. References dialog box in order to permit. Then, using the object is relatively simple. First, declare a. Dim Custom. WB As WBCustomizer. Set Custom. WB = New WBCustomizer. Then, set the object properties to specify the desired customization, and. Web. Browser control. This code assumes that the Web. Browser. control is named Web. Browser. 1. It turns off all context menus and accelerator. With Custom. WB. Enable. Context. Menus = False. Enable. All. Accelerators = False. Set . Web. Browser = Web. Browser. 1End With. The sample Visual Basic project that comes with the DLL provides examples of disabling. In theory the Internet Transfer Control is the best thing since sliced bread. Even though the latest version. Sometimes the. Open. URL method does not retrieve an entire page. Also, I find that trying to use. Office. components often leads to weird and impossible to solve bugs. If you need to. retrieve HTML pages, you can do so easily by calling some functions in the. Win. Inet library. Without going into the details, here's how. First, put the. following declarations in your project (in a code module): Public Const INTERNET. For example, sending raw data to the printer port seems to be impossible. I. wanted to make the printer port's 8 data lines output a specific bit pattern, such as. My task was to use the computer to control a piece of. I tried a variety of Windows API calls. Visual Basic is unavoidable. The solution lay in Visual C++, which has the . I compiled the code into a DLL called PPORT. DLL, which you can download. ZIP format by. clicking here. Put the DLL in the. Windows\System folder, then declare the function in your Visual Basic program as follows: Declare Function Send. Byte. To. Port Lib. The argument b is the. The function's return value can be ignored. Be. careful when using this function, because by writing directly to the hardware it bypasses. Windows safety nets. You can get into all sorts of trouble if you are not careful! I have not tested. Kris says it works fine. Public Type DOCINFOp. Doc. Name As Stringp. Output. File As Stringp. Datatype As String. End Type. Public Declare Function Close. Printer Lib . Given all of the support files that a Visual Basic program requires. This is a special concern when. It is important to ensure that your distribution. Yet, the Setup Wizard will sometimes include files in. Why is this? The problem is that the Setup Wizard is not smart enough to determine which software. Visual Basic development environment at the time the program was compiled. For. example, if the . Therefore, you need to remove all of the components that your program does not. Components dialog box before compiling your program. Fortunately. Visual Basic is. I shrank a 2. 5. MB. MB using this technique, so the gains can be significant. The function presented here is passed a string and returns the string with its. Note that. Visual Basic 6 has its own function Str. Reverse that does the same thing, so this is for. Visual Basic. Public Function Reverse(s As String) As String. Returns a string with the characters. I discovered this recently when trying to capture screens from. Visual Basic program - you cannot send Alt+Print. Scr using Send. Keys. As far as I can tell, the operating system has no way of knowing whether a. Keybd. Here’s the function declaration: Private Declare Sub keybd. First declare the following constant: Const VK. If you maintain a web page with. If lots of the links on your page are dead, your visitors will not. Many web page design tools, such as Front. Page, have a . They tell you which. OK and which are not, but they do not permit you to do anything about. I needed a. better solution. I keep my links database in an Excel worksheet - one column for URL, one for Title. I have written an Excel Basic macro that reads through the table and writes the HTML. I decided to write a Visual Basic program that would. Use DDE to read a URL from the links worksheet. Attempt to connect to the URL and note whether the URL is valid or not. Use DDE to put the label . Create a form with a Text Box, an Internet Transfer control, four. Label controls, and a control array of two Command Buttons. Here is the code for the. Form. Public Sub Check. Links()Dim row As Integer, url As String. Dim buf As String, msg As String, fnf As Integer. Dim snf As Integer, tout As Integer, ok As Integer. On Error Resume Next' Make row equal to the Worksheet row where' your data starts. Minimize the form. Form. 1. Window. State = 1. Do' I keep URLs in column 3 (C) of the worksheet. XLObj. Cells(row, 3)' If it's empty we are done. If url = . Error' messages will be found here. If Len(Text. 1. Text) > 5. Thenbuf = Left(Text. Text, 5. 0)Elsebuf = Text. Text. End If' Catch a time out error. If Err = 3. 57. 61 Thenmsg = . You can download a ZIP file containing the Visual Basic project by clicking here. Note: Since originally creating this project I have made some modifications. First, the links information is. Access database rather than in an Excel workbook. The Visual Basic. ADO to read and write the data table. Second, I have abandoned the. Internet Transfer control in favor of using the Win. INet library to implement the. Details of using Win. INet are presented here. For a Visual Basic program to connect to a data source, a connection. This string specifies the data source, user name. Here's an. example of a fairly simple connection string. Provider=Microsoft. Jet. OLEDB. 3. 5. Persist Security Info=False; User ID=Alice. K; Data. Source=C: \data\Northwind. Who can remember all the details required to write. Visual Basic can help you, as follows: Make sure the ADO Data Control is displayed in the. Visual Basic. toolbox. This is not the standard Data control, but is identified by a tooltip. If it is not present you will have to add it by pressing. Ctrl+T to open the Components dialog box then putting a checkmark next to. The control's property page displays, Select the Use. Connection String option, then click the Build button. The next dialog box contains several tabs on which you. DSN (if you are using one), the user name and password, and the. You can also test the connection from this dialog box. When you are finished defining the connection, click OK. The generated connection. Copy the generated connection string from the Property. Page to your code. Delete the ADO Data Control from the form. This method for creating connection strings is a lot faster. The Visual Basic form designer makes it easy to align a group of. Simply select the controls by holding. For example, you might want to. Text. Box controls so their left edges are all exactly 5. Here's how: Select all the controls as described above. It does not. matter which control is selected last. In the Properties window, enter the desired distance. Left property. Or, to align at a fixed. Top property. This technique can be extended to other design tasks. When. more than one control is selected, the Properties window displays only those. Changing a property value is. Most Visual Basic programmers never make use of the Tag property. After all, this property doesn't do anything so. The truth is, it can be very useful in a variety of. You can store any information you want in a control's Tag property. One example is when you create a control array of. Command. Button controls. Programmers usually use the Index argument that is. Click event procedure to identify which button in the array was. By assigning each button a descriptive Tag property you can use that. Here's the code for a simple example: Private Sub. Command. 1. A Tree. View is made up of nodes, and it can be useful to have. This is. easily accomplished by using the Tag property of each Node object. Lots of programmers don't even know about Visual. Do. Events function. This is not surprising because few Visual Basic programs need it. In my experience, the only time. Do. Events is needed is when a program has code that takes a long time to execute. By calling Do. Events at. To see what I mean, create a Standard EXE project in Visual. Command. Button and one Text. Box on the form. Then, put the following. Command Button's Click event procedure: Private. Sub Command. 1. Each time. The problem is that. Windows queue. When the loops were finished, all these. Now, place a call to Do. Events in the code, just after the. Text. 1. Text = i statement.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2017
Categories |