Source Code Sharing - HOT SCRIPTS

 When you’re writing code, you often need to look for source code to use as a reference, right? Here’s a website that is said to be the largest source code sharing site in the world. I don’t think it’s really the largest, but it’s definitely among the top two :) URL: http://www.hotscripts.com/ When you enter this website, you’ll see the category page. The categories are organized by programming language. The main ones are PHP, CGI, ASP, Perl, Java Scripts .AJAX, C & C++, Ruby On Rails (RoR), Python, and so on, with source code for each. You can pick the language you want to use and then browse through it slowly. Or you can use the search function in the upper-right corner. But don’t type Chinese. Because this is a foreign website, there isn’t much Chinese code. You can also search within certain categories, or search everything (the one that says All………..). Just select it from the dropdown menu in the search box. Once you’ve found the program you want, you can take a quick look at its description. If you want to download it, just click the Download button in the window. One more thing to note: some programs are paid. Usually the ones marked with a (Sponsor) badge are paid. This website also offers account registration. In fact, I never needed to register an account when I used it. ...

May 2, 2009 · 2 min

[VB.NET] Renaming Files with rename

Today I’m going to show you how to rename a file using a method that VB itself provides. Its syntax is: Filesystem.rename(a,b) a is the input file, that is, the file to be renamed. b is the output file name. Please note that both parameters a and b must be given in full form. Suppose you want to rename the file c:123.txt to 456.txt. Then you enter: Filesystem.rename("c:123"."c:456.txt") Be careful! Both of my parameters include the file extension, and both include the drive letter and folder name. ...

April 23, 2009 · 1 min

How to Write Functions in VB (Major Error Correction)

Today I’m going to teach everyone how to write their own functions. First, you need to know the syntax for functions. Also, you must place your own functions at the very bottom of the program. Syntax: Function FunctionName(Byval Parameter As ParameterType,Byval Parameter As ParameterType) FunctionName = (what the function does) End Function A quick explanation: you can name the function whatever you like, and you don’t need to wrap the name in double quotes. Parameters are optional. Whether you need them depends on what the function does. If the function needs to receive values, you have to set them up. ...

April 19, 2009 · 2 min

VB Syntax for Showing and Closing Forms

 In VB, if you want to switch to another form, you can use the show() syntax. The syntax is as follows: FormName.show() FormName is the name of the form you want to switch to. For example, if you want to switch to a form called form2, enter form2.show(). If you want to open a new form and then close the old one, the syntax is: FormName.close() To close the form itself, enter me.close() ' means “close myself” This syntax can also be used to close other forms. The only condition is that the form you close must belong to your own program (well, obviously~~)

April 17, 2009 · 1 min

[VB] Replacing Text with the Replace Function

If you want to replace part of a string with something else in VB, you can use the Replace function. The syntax is as follows: StringName.replace(A,B) StringName is the name of the variable where your text is stored. For example, say you store 123456 in S1. Then you enter S1.replace(A,B) ...

April 17, 2009 · 1 min

Keep a Window Always on Top with SetWindowPos

First, add a Timer control to the program. Enable the timer (named timer1). Set its interval to 100. Then enter the following code (paste it over the existing code, replacing what is already there). Option Strict Off Option Explicit On Public Class Form1 Inherits System.Windows.Forms.Form Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Integer, ByVal hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer Dim IntR As Object Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Top = 0 Me.Left = 0 Me.Width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width Me.Height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick IntR = SetWindowPos(Me.Handle.ToInt32, -1, 0, 0, 0, 0, 3) End Sub End Class

February 14, 2009 · 1 min

VB Keyboard Simulation

The keyboard is still one of the most important input devices for using a computer. Even in today’s mouse-dominated world, many programs still can’t do without it. But repetitive, tedious keyboard operations can wear people out, so people came up with the idea of using a program to press keys in their place. That saves a lot of effort, and it is exactly what Keyboard Genie (Anjian Jingling) does. So how can we use VB to write a program with similar functionality? Let’s first look at how Windows responds to keyboard events. ...

November 26, 2008 · 24 min