This site provides users with the information about html: make web page load faster, how to make webpage with javascript load fast, delay javascript loading, load javascript after all page loaded, defer javascript loading, load javascript last, use onload in body, speed up web page loading, improve web page loading time, accelerate page Loading, guide, example, tips, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to make webpage with javascript load faster in html?
Web page load time is directly related to your web traffic. Your visitors will leave your site if your page is loading slowly and Google also takes the page loading time seriously to rank a website. So you should do your best to speed up your page loading.
One of the main problems for webpage slow loading is the javascript, especially the external javascript that is not from your own web server and you cannot control it. The reason why the web page gets slower when it comes with javascript is that when the web broswers come to read or download the contents of the javascript, it stops further reading until finishing reading the contents of the javascript. If the web server where you use the javascript to connect to gets hacked and responds very slowly, the webbrowsers will take longer time to read and as a result, your web page will be shown incompletely or just blank page, which depends on the design of your web page. There are several ways that you can better this situation. Now let's have a look at them one after another in the following:
1. Insert javascript just before the tag, < /body> as follows:
--------------------------------------------------------------------------------
< html>
< body>
< h1>designed by www.edusoftmax.com< /h1>
< p>designed by www.edusoftmax.com< /p>
< SCRIPT LANGUAGE="JavaScript" SRC="http://www.edusoftmax.com/">< /SCRIPT>
< /body>
< /html>
--------------------------------------------------------------------------------
2. Use defer = "defer" attribute as follows:
--------------------------------------------------------------------------------
< script type="text/javascript" src="http://www.edusoftmax.com/" defer="defer">
< /script>
--------------------------------------------------------------------------------
Note:
The "defer" attribute delays the downloading of the contents of the javascript until the whole html contents downloaded completely. You should also note that "defer" attribute works both inline and external javascript.
3. Add javascript in an html file and use iframe to display it. Let's look at it in the following:
--------------------------------------------------------------------------------
< html>
< body>
< h1>designed by www.edusoftmax.com< /h1>
< p>designed by www.edusoftmax.com< /p>
< IFRAME src="http://www.edusoftmax.com/reference.html" name="inside_frame"
width="500" height="300" SCROLLING=NO SCROLLING=NO frameborder="0">
< /IFRAME>
< /body>
< /html>
--------------------------------------------------------------------------------
Note:
You add the javascript in the first example above
--------------------------------------------------------------------------------
< SCRIPT LANGUAGE="JavaScript" SRC="http://www.edusoftmax.com/">< /SCRIPT>
--------------------------------------------------------------------------------
into the file, "reference.html"
4. Use onload in < body> tag. Let's look at it in the following:
--------------------------------------------------------------------------------
< html>
< head>
< script type="text/javascript">
function myJavascript(){
var t=setTimeout("delayfunction()",3000);
}
function delayfunction(){
var urlsrc=document.createElement('script');
urlsrc.src="http://www.edusoftmax.com/";
document.getElementsByTagName('head')[0].appendChild(urlsrc);
}
< /script>
< /head>
< body onload="myJavascript()">
< /body>
< /html>
--------------------------------------------------------------------------------
Other tips on making web page loading fast
1. Use fast web hosting server.
2. Reduce image size by using software or specifying image dimensions. If possible, use fewer images.
3. Reduce using flash file.
4. Use CSS.
5. Avoid using nested tables.
6. Using fewer javascripts.
7. Avoid using redirects.
Final note:
After using the above techniques and your page still shows blank or partially displayed, it is very important for you to add a text "Page is loading" at the top so that the visitors may wait for a while.
For other hundreds of computer repair tips, tricks, tweaks, guide, and help, please go to http://www.edusoftmax.com
chitika
Thursday, September 29, 2011
website hosting tips, secrets, guide
This site provides users with the information about website hosting, website hosting tips, choose website hosting provider guide, how to choose free website hosting company secrets, web traffic interception, web traffic filter, web traffic redirect, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
Choosing a better website hosting company is very important for your online business. For most webmasters, they usually neglect some important factors which is directly related to their web traffic, that is, their online business. In the following, we will reveal some secrets for selecting a better website hosting provider -- our many years of experiences!
1. Read reviews.
Reading web hosting provider reviews is the first thing you should do. From there, you can find lots of information about the web hosting company of your candidates.
2. Check out the features of the web hosting provider.
The important features to check out are webspace, bandwidth, number of subdomain, email service, programming languages, and database. Please note that for some web hosting companies, they do not have free email services for free hosting package.
3. Check out the page loading speed and the uptime of the web hosting provider.
Before registration, you can go to their website to check out the page loading time several times, at the different time period. After registration, you can use your ftp software to check out if the uploading is fast. This is the very important factor for quality web hosting.
4. Check out their custom services.
You can call them at 1 - 2 a.m. because they should have 24 hours customer service or email them and see how long you can get response from them.
5. Check out web hosting reliability and protect your valuable traffic.
If you are doing the online business, it is very important for you to make web hosting reliability check. There are two main things that you need to check out. One is the web traffic interception and the other is the web traffic filter.
1) Traffic interception
For traffic interception, most of the webmasters never notice it. Some of the webmasters are very happy that they find a free web hosting with no banner insertion, unlimited bandwidth or lots of bandwidth, and lots of web space, but they never think of how much web traffic they lose if they choose a "unreliable" hosting provider. The following is what we found how your web traffic will be lost:
a. "Disable" your page for showing and make "Page not found" and then when visitors go to your page, they will be redirected to an advertisement page. The interesting thing is that at the time of the page redirection, your page can still be found on the web server and can also be downloaded.
b. Insert code at the end of your page or use other methods to redirect your traffic directly to their ad page, even before your page shown. For example, when your visitor click the link from a search engine after he makes a search with a keyword, he will see their ad page right away instead of your page. As a result, the search keyword does not match with the contents of the page shown or the contents supposed to be in the search engine database.
c. Replace the contents of your page with their ad contents.
Because of the above, over time (several months), your web traffic will be dropped greatly because the search engines lowered your website ranking after they repeatedly found "Page not found" and search query does not match with the web contents.
It is not easy for you to find out something happened like the above, but there are two techniques that you can use to give you some clues of a possible unreliable web hosting provider as follows:
a. You can enter a non-existing file to see if it will land on an ad page. You need to try it several times and at the different time period because they do it randomly. For some web hosting providers, you need to wait for some times after you see the 404 page from that hosting provider because they will redirect again to an ad page after serveral seconds.
b. After your page displayed over the internet, use View Source to open the source code of your page to see if any additional code from your web hosting provider is added to your page code.
If the above is confirmed, stop using their service as soon as possible before the big loss of your valuable traffic. This applies to both free and paid website hosting.
2) Traffic filter
For web traffic filter, some web hosting providers will filter the web traffic, that is, they will block the whole ips from the centain countries because of a few virus attacks from there. We think that blocking ips including good ones is not a good way to prevent virus attacks. It only drives their customers away.
If you think that this site is helpful, please recommend your friends to visit our site.
Choosing a better website hosting company is very important for your online business. For most webmasters, they usually neglect some important factors which is directly related to their web traffic, that is, their online business. In the following, we will reveal some secrets for selecting a better website hosting provider -- our many years of experiences!
1. Read reviews.
Reading web hosting provider reviews is the first thing you should do. From there, you can find lots of information about the web hosting company of your candidates.
2. Check out the features of the web hosting provider.
The important features to check out are webspace, bandwidth, number of subdomain, email service, programming languages, and database. Please note that for some web hosting companies, they do not have free email services for free hosting package.
3. Check out the page loading speed and the uptime of the web hosting provider.
Before registration, you can go to their website to check out the page loading time several times, at the different time period. After registration, you can use your ftp software to check out if the uploading is fast. This is the very important factor for quality web hosting.
4. Check out their custom services.
You can call them at 1 - 2 a.m. because they should have 24 hours customer service or email them and see how long you can get response from them.
5. Check out web hosting reliability and protect your valuable traffic.
If you are doing the online business, it is very important for you to make web hosting reliability check. There are two main things that you need to check out. One is the web traffic interception and the other is the web traffic filter.
1) Traffic interception
For traffic interception, most of the webmasters never notice it. Some of the webmasters are very happy that they find a free web hosting with no banner insertion, unlimited bandwidth or lots of bandwidth, and lots of web space, but they never think of how much web traffic they lose if they choose a "unreliable" hosting provider. The following is what we found how your web traffic will be lost:
a. "Disable" your page for showing and make "Page not found" and then when visitors go to your page, they will be redirected to an advertisement page. The interesting thing is that at the time of the page redirection, your page can still be found on the web server and can also be downloaded.
b. Insert code at the end of your page or use other methods to redirect your traffic directly to their ad page, even before your page shown. For example, when your visitor click the link from a search engine after he makes a search with a keyword, he will see their ad page right away instead of your page. As a result, the search keyword does not match with the contents of the page shown or the contents supposed to be in the search engine database.
c. Replace the contents of your page with their ad contents.
Because of the above, over time (several months), your web traffic will be dropped greatly because the search engines lowered your website ranking after they repeatedly found "Page not found" and search query does not match with the web contents.
It is not easy for you to find out something happened like the above, but there are two techniques that you can use to give you some clues of a possible unreliable web hosting provider as follows:
a. You can enter a non-existing file to see if it will land on an ad page. You need to try it several times and at the different time period because they do it randomly. For some web hosting providers, you need to wait for some times after you see the 404 page from that hosting provider because they will redirect again to an ad page after serveral seconds.
b. After your page displayed over the internet, use View Source to open the source code of your page to see if any additional code from your web hosting provider is added to your page code.
If the above is confirmed, stop using their service as soon as possible before the big loss of your valuable traffic. This applies to both free and paid website hosting.
2) Traffic filter
For web traffic filter, some web hosting providers will filter the web traffic, that is, they will block the whole ips from the centain countries because of a few virus attacks from there. We think that blocking ips including good ones is not a good way to prevent virus attacks. It only drives their customers away.
Tuesday, September 20, 2011
vb: how to use do loop, for loop, while loop, exit loop?
This site provides users with the information about vb, visual basic, vb6, do loop, for loop, while loop, how to use do loop, how to use for loop, how to use while loop, exit loop, do until, while wend, for, next, for loop step, example, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to use do loop, for loop, while loop, exit loop in vb?
The following is the code for using do loop, for loop, while loop, exit loop in vb:
1. do until ... loop and do while ... loop
--------------------------------------------------------------------------------
Dim ct As Integer
Do Until ct = 10
ct = ct + 1
If (ct = 8) Then
Exit Do
end if
Loop
Do while ct < 10
ct = ct + 1
If (ct = 8) Then
Exit Do
end if
Loop
--------------------------------------------------------------------------------
2. While... Wend loop
--------------------------------------------------------------------------------
Dim no As Integer
no = 1
While no <=100
no = no + 1
if(no=50)then
Exit While
end if
Wend
--------------------------------------------------------------------------------
3. for ... next loop
--------------------------------------------------------------------------------
Dim i As Integer
For i = 0 To 15
if (i=8)then
exit for
end if
Next i
For I = 10 To 0 Step -2
Debug.Print I
Next I
Note:
"Step -2": For-Next loop is decremented by 2 each time through the loop.
If you think that this site is helpful, please recommend your friends to visit our site.
How to use do loop, for loop, while loop, exit loop in vb?
The following is the code for using do loop, for loop, while loop, exit loop in vb:
1. do until ... loop and do while ... loop
--------------------------------------------------------------------------------
Dim ct As Integer
Do Until ct = 10
ct = ct + 1
If (ct = 8) Then
Exit Do
end if
Loop
Do while ct < 10
ct = ct + 1
If (ct = 8) Then
Exit Do
end if
Loop
--------------------------------------------------------------------------------
2. While... Wend loop
--------------------------------------------------------------------------------
Dim no As Integer
no = 1
While no <=100
no = no + 1
if(no=50)then
Exit While
end if
Wend
--------------------------------------------------------------------------------
3. for ... next loop
--------------------------------------------------------------------------------
Dim i As Integer
For i = 0 To 15
if (i=8)then
exit for
end if
Next i
For I = 10 To 0 Step -2
Debug.Print I
Next I
Note:
"Step -2": For-Next loop is decremented by 2 each time through the loop.
vb: how to use messsage box, yes, no msgbox?
This site provides users with the information about vb, visual basic, vb6, message box, yes, no message box, how to use msgbox, example, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to use messsage box, yes, no msgbox in vb?
Let's first look at its syntax as follows:
MsgBox(prompt[, buttons] [, title] [, helpfile,
Prompt: text of the message box
buttons: vbCritical, vbQuestion, vbExclamation, and vbInformation.
title: title of the message box
helpfile: These arguments are only applicable when a Help file has been set up to work with the application. It is optional.
The following is the code for using messsage box, yes, no msgbox in vb:
1. Basic message box / msgbox
--------------------------------------------------------------------------------
MsgBox "Please enter your name first.", _
vbExclamation + vbOKOnly, _
"Account Information"
--------------------------------------------------------------------------------
2. Yes or no message box / msgbox
--------------------------------------------------------------------------------
Dim iResponse As Integer
iResponse = MsgBox("Are you sure that you want to delete all the records?", _
vbYesNo + vbQuestion, _
"Deletion")
If iResponse = vbYes Then
Msgbox "All the records have been deleted!"
else
Msgbox "All the records have not been deleted!"
End If
If you think that this site is helpful, please recommend your friends to visit our site.
How to use messsage box, yes, no msgbox in vb?
Let's first look at its syntax as follows:
MsgBox(prompt[, buttons] [, title] [, helpfile,
Prompt: text of the message box
buttons: vbCritical, vbQuestion, vbExclamation, and vbInformation.
title: title of the message box
helpfile: These arguments are only applicable when a Help file has been set up to work with the application. It is optional.
The following is the code for using messsage box, yes, no msgbox in vb:
1. Basic message box / msgbox
--------------------------------------------------------------------------------
MsgBox "Please enter your name first.", _
vbExclamation + vbOKOnly, _
"Account Information"
--------------------------------------------------------------------------------
2. Yes or no message box / msgbox
--------------------------------------------------------------------------------
Dim iResponse As Integer
iResponse = MsgBox("Are you sure that you want to delete all the records?", _
vbYesNo + vbQuestion, _
"Deletion")
If iResponse = vbYes Then
Msgbox "All the records have been deleted!"
else
Msgbox "All the records have not been deleted!"
End If
vb: how to create progress bar with timer?
This site provides users with the information about vb, visual basic, vb6, create progress bar, how to create progress bar, how to use timer, example, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to create progress bar with timer in vb?
The following is the code and steps for creating progress bar with timer in vb:
1. Add Microsoft common dialog control from Components.
2. In design mode, add Progress Bar and Timer onto your form.
3. Click on Timer and change Interval to 10.
4. If you do not want the standard progress bar, you can change it to smooth Progress Bar from Scrolling property.
5. Double click the Timer and add the following code:
--------------------------------------------------------------------------------
Private Sub Timer1_Timer()
ProgressBar1.Value = ProgressBar1.Value + 1
If ProgressBar1.Value = 50 Then
ProgressBar1.Value = ProgressBar1 + 50
End If
If ProgressBar1.Value >= ProgressBar1.Max Then
Timer1.Enabled = False
End If
End Sub
If you think that this site is helpful, please recommend your friends to visit our site.
How to create progress bar with timer in vb?
The following is the code and steps for creating progress bar with timer in vb:
1. Add Microsoft common dialog control from Components.
2. In design mode, add Progress Bar and Timer onto your form.
3. Click on Timer and change Interval to 10.
4. If you do not want the standard progress bar, you can change it to smooth Progress Bar from Scrolling property.
5. Double click the Timer and add the following code:
--------------------------------------------------------------------------------
Private Sub Timer1_Timer()
ProgressBar1.Value = ProgressBar1.Value + 1
If ProgressBar1.Value = 50 Then
ProgressBar1.Value = ProgressBar1 + 50
End If
If ProgressBar1.Value >= ProgressBar1.Max Then
Timer1.Enabled = False
End If
End Sub
html: how to limit text field char, text box char, textarea character
This site provides users with the information about html: how to limit text field characters, limit textarea characters, how to limit text box characters in html, how to check characters in text field, textarea, example, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to limit text field, text box, textarea characters in html
For limiting text field, text box, textarea characters in html, you need to add a little javascript code. The following is an example for how to limit text field, text box, textarea characters in html.
--------------------------------------------------------------------------------
< script>
function checkchars(cur)
{
var maxlength=50
if (cur.chars.value.length>maxlength){
alert("Please limit your input to 50 or less characters!")
return false
}
}
//-->
< /script>
< form onsubmit="return checkchars(this)">
Please type a title of webpage within 50 chars or less:
< br>
< input type="text" size="68" name="chars" >
< br>
< input type="submit" value="Submit!">
< /form>
< form onsubmit="return checkchars(this)">
Please type a description of webpage within 50 chars or less:
< br>
< textarea rows="5" cols="58" name="chars">
< br>
< input type="submit" value="Submit!">
< /form>
If you think that this site is helpful, please recommend your friends to visit our site.
How to limit text field, text box, textarea characters in html
For limiting text field, text box, textarea characters in html, you need to add a little javascript code. The following is an example for how to limit text field, text box, textarea characters in html.
--------------------------------------------------------------------------------
< script>
function checkchars(cur)
{
var maxlength=50
if (cur.chars.value.length>maxlength){
alert("Please limit your input to 50 or less characters!")
return false
}
}
//-->
< /script>
< form onsubmit="return checkchars(this)">
Please type a title of webpage within 50 chars or less:
< br>
< input type="text" size="68" name="chars" >
< br>
< input type="submit" value="Submit!">
< /form>
< form onsubmit="return checkchars(this)">
Please type a description of webpage within 50 chars or less:
< br>
< textarea rows="5" cols="58" name="chars">
< br>
< input type="submit" value="Submit!">
< /form>
html: how to limit text field word, text box words, textarea words
This site provides users with the information about html: how to limit text field words, limit text box words, limit textarea words, how to limit text box words in html, how to check how many words in text field, textarea, example, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to limit text field, text box, textarea words in html
For limiting text field, text box, textarea words in html, you need to add a little javascript code. The following is an example for how to limit text field, text box, textarea words in html.
--------------------------------------------------------------------------------
< script>
function checkwords(cur){
var maxwords=20
if (document.images){
var temp=cur.words.value.split(" ")
if (temp.length>maxwords){
alert("Please limit your input to 20 or less words!")
return false
}
}
}
//-->
< /script>
< form onsubmit="return checkwords(this)">
Please type a title of webpage within 20 words or less:
< br>
< input type="text" size="68" name="words" >
< br>
< input type="submit" value="Submit!">
< /form>
< form onsubmit="return checkwords(this)">
Please type a description of webpage within 20 words or less:
< br>
< textarea rows="5" cols="58" name="words">
< br>
< input type="submit" value="Submit!">
< /form>
If you think that this site is helpful, please recommend your friends to visit our site.
How to limit text field, text box, textarea words in html
For limiting text field, text box, textarea words in html, you need to add a little javascript code. The following is an example for how to limit text field, text box, textarea words in html.
--------------------------------------------------------------------------------
< script>
function checkwords(cur){
var maxwords=20
if (document.images){
var temp=cur.words.value.split(" ")
if (temp.length>maxwords){
alert("Please limit your input to 20 or less words!")
return false
}
}
}
//-->
< /script>
< form onsubmit="return checkwords(this)">
Please type a title of webpage within 20 words or less:
< br>
< input type="text" size="68" name="words" >
< br>
< input type="submit" value="Submit!">
< /form>
< form onsubmit="return checkwords(this)">
Please type a description of webpage within 20 words or less:
< br>
< textarea rows="5" cols="58" name="words">
< br>
< input type="submit" value="Submit!">
< /form>
html: how to validate email form using javascript?
This site provides users with the information about html: email form validation, how to validate email form, javascript email form validation, how to validate email address, clear form, example, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to validate email form using javascript?
For validating email form, you need to add a little javascript code. The following is an example for how to validate email form using javascript in html.
--------------------------------------------------------------------------------
< SCRIPT LANGUAGE="JavaScript">
function fixProblem(element, message) {
alert(message);
element.focus();
}
function checkValidation(form) {
var passed = false;
if (form.fullname.value == "") {
fixProblem(form.fullname, "Please enter your name.");
}
else if (form.email.value.indexOf("@") == -1 ||
form.email.value.indexOf(".") == -1) {
fixProblem(form.email, "Email address invalid!");
}
else if (form.message.value == "") {
fixProblem(form.message, "Please enter a message.");
}
else {
passed = true;
}
return passed;
}
< /SCRIPT>
< FORM NAME = "mail" ACTION = "mailto:yourname@gmail.com" METHOD = "POST" ENCTYPE = "text/plain" onSubmit = "return checkValidation (this);">
< TABLE BORDER = 0 CELLPADDING = 5 CELLSPACING = 0>
< TR>
< TD>
Your Full Name:
< P>
< INPUT TYPE = "TEXT" NAME = "fullname" >
< /TD>
< TD>
Your Email Address:
< P>
< INPUT TYPE = "TEXT" NAME = "email" >
< /TD>
< /TR>
< TR>
< TD COLSPAN = "2">
Enter your Message:
< P>
< TEXTAREA ROWS = "8" COLS = "38" NAME = "message">
< /TEXTAREA>
< /TD>
< /TR>
< TR>
< TD COLSPAN = "2">
< INPUT TYPE = "SUBMIT" VALUE = "Submit">
< INPUT TYPE = "RESET" VALUE = "Clear">
< /TD>
< /TR>
< /TABLE>
< /FORM>
If you think that this site is helpful, please recommend your friends to visit our site.
How to validate email form using javascript?
For validating email form, you need to add a little javascript code. The following is an example for how to validate email form using javascript in html.
--------------------------------------------------------------------------------
< SCRIPT LANGUAGE="JavaScript">
function fixProblem(element, message) {
alert(message);
element.focus();
}
function checkValidation(form) {
var passed = false;
if (form.fullname.value == "") {
fixProblem(form.fullname, "Please enter your name.");
}
else if (form.email.value.indexOf("@") == -1 ||
form.email.value.indexOf(".") == -1) {
fixProblem(form.email, "Email address invalid!");
}
else if (form.message.value == "") {
fixProblem(form.message, "Please enter a message.");
}
else {
passed = true;
}
return passed;
}
< /SCRIPT>
< FORM NAME = "mail" ACTION = "mailto:yourname@gmail.com" METHOD = "POST" ENCTYPE = "text/plain" onSubmit = "return checkValidation (this);">
< TABLE BORDER = 0 CELLPADDING = 5 CELLSPACING = 0>
< TR>
< TD>
Your Full Name:
< P>
< INPUT TYPE = "TEXT" NAME = "fullname" >
< /TD>
< TD>
Your Email Address:
< P>
< INPUT TYPE = "TEXT" NAME = "email" >
< /TD>
< /TR>
< TR>
< TD COLSPAN = "2">
Enter your Message:
< P>
< TEXTAREA ROWS = "8" COLS = "38" NAME = "message">
< /TEXTAREA>
< /TD>
< /TR>
< TR>
< TD COLSPAN = "2">
< INPUT TYPE = "SUBMIT" VALUE = "Submit">
< INPUT TYPE = "RESET" VALUE = "Clear">
< /TD>
< /TR>
< /TABLE>
< /FORM>
vb: how to read out text (text to speech)?
This site provides users with the information about vb, visual basic, vb6, text to speech, how to speak text, read out text, make computer speak, how to create program to speak, make pc talk, example, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to read out text (text to speech) in vb?
The following is the code and steps for reading out text (text to speech) in vb:
1. Add Microsoft Speech Object Library from References.
2. Create a button and add the following code in it.
--------------------------------------------------------------------------------
Private Sub Command1_Click()
Dim objVoice As Object
Dim userInput As String
userInput = InputBox("Type anything to be spoken out in the following:")
Set objVoice = CreateObject("SAPI.spVoice")
objVoice.Speak userInput
Set objVoice = Nothing
End Sub
If you think that this site is helpful, please recommend your friends to visit our site.
How to read out text (text to speech) in vb?
The following is the code and steps for reading out text (text to speech) in vb:
1. Add Microsoft Speech Object Library from References.
2. Create a button and add the following code in it.
--------------------------------------------------------------------------------
Private Sub Command1_Click()
Dim objVoice As Object
Dim userInput As String
userInput = InputBox("Type anything to be spoken out in the following:")
Set objVoice = CreateObject("SAPI.spVoice")
objVoice.Speak userInput
Set objVoice = Nothing
End Sub
Friday, September 16, 2011
vb: how to create irregular, custom shaped form?
This site provides users with the information about vb, visual basic, vb6, create irregular form, how to create custom shaped form, example, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to create irregular form, custom shaped in vb?
The following is the example and steps to create irregular form, custom shaped in vb:
1. Add the following code in declare section:
--------------------------------------------------------------------------------
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, _
ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, _
ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function DeleteObject Lib "gdi32" _
(ByVal hObject As Long) As Long
Dim r_handler As Long
Dim width As Long
Dim height As Long
--------------------------------------------------------------------------------
2. Add the following code in form resize section:
--------------------------------------------------------------------------------
width = ScaleX(Me.width, Me.ScaleMode, vbPixels) - 1
height = ScaleY(Me.height, Me.ScaleMode, vbPixels) - 1
'width = 250
'height = 250
'change the parameters to change the shape
r_handler = CreateEllipticRgn(0, 0, width, height)
Call SetWindowRgn(Me.hWnd, r_handler, True)
Call DeleteObject(hRgn)
If you think that this site is helpful, please recommend your friends to visit our site.
How to create irregular form, custom shaped in vb?
The following is the example and steps to create irregular form, custom shaped in vb:
1. Add the following code in declare section:
--------------------------------------------------------------------------------
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, _
ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, _
ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function DeleteObject Lib "gdi32" _
(ByVal hObject As Long) As Long
Dim r_handler As Long
Dim width As Long
Dim height As Long
--------------------------------------------------------------------------------
2. Add the following code in form resize section:
--------------------------------------------------------------------------------
width = ScaleX(Me.width, Me.ScaleMode, vbPixels) - 1
height = ScaleY(Me.height, Me.ScaleMode, vbPixels) - 1
'width = 250
'height = 250
'change the parameters to change the shape
r_handler = CreateEllipticRgn(0, 0, width, height)
Call SetWindowRgn(Me.hWnd, r_handler, True)
Call DeleteObject(hRgn)
vb: how to move cursor and click where cursor is?
This site provides users with the information about vb, visual basic, vb6, move cursor and click it, how to move cursor and click where cursor is, example, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to move cursor and click it in vb?
The follow code is very useful when you want to write a automation program to move a cursor to where the textbox is and use Sendkeys to add some text to it or move the cursor to where the button is and click the button. The following are steps to move cursor and click where the cursor is in vb:
1. Add the following code in declare section:
--------------------------------------------------------------------------------
'declare for moving cursor position
Private Declare Function SetCursorPos Lib "user32" _
(ByVal x As Long, ByVal y As Long) As Long
'declare for clicking where the cursor is
Private Declare Sub mouse_event Lib "user32" _
(ByVal dwFlags As Long, _
ByVal dx As Long, _
ByVal dy As Long, _
ByVal cButtons As Long, _
ByVal dwExtraInfo As Long)
Private Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINT) As Long
Private Type POINT
x As Long
y As Long
End Type
Private Const MOUSEEVENTF_ABSOLUTE = &H8000 'absolute move
Private Const MOUSEEVENTF_LEFTDOWN = &H2 'left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 'left button up
Private Const MOUSEEVENTF_MIDDLEDOWN = &H20 'middle button down
Private Const MOUSEEVENTF_MIDDLEUP = &H40 'middle button up
Private Const MOUSEEVENTF_RIGHTDOWN = &H8 'right button down
Private Const MOUSEEVENTF_RIGHTUP = &H10 'right button up
Dim p As POINT
--------------------------------------------------------------------------------
2. Add the following code in a button procedure:
--------------------------------------------------------------------------------
Private Sub cmdOK_Click()
'move cursor
Call SetCursorPos(400, 300)
'find cursor position
Call GetCursorPos(p)
'mouse click
Call mouse_event(MOUSEEVENTF_LEFTDOWN, p.x, p.y, 0&, 0&)
Call mouse_event(MOUSEEVENTF_LEFTUP, p.x, p.y, 0&, 0&)
End Sub
If you think that this site is helpful, please recommend your friends to visit our site.
How to move cursor and click it in vb?
The follow code is very useful when you want to write a automation program to move a cursor to where the textbox is and use Sendkeys to add some text to it or move the cursor to where the button is and click the button. The following are steps to move cursor and click where the cursor is in vb:
1. Add the following code in declare section:
--------------------------------------------------------------------------------
'declare for moving cursor position
Private Declare Function SetCursorPos Lib "user32" _
(ByVal x As Long, ByVal y As Long) As Long
'declare for clicking where the cursor is
Private Declare Sub mouse_event Lib "user32" _
(ByVal dwFlags As Long, _
ByVal dx As Long, _
ByVal dy As Long, _
ByVal cButtons As Long, _
ByVal dwExtraInfo As Long)
Private Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINT) As Long
Private Type POINT
x As Long
y As Long
End Type
Private Const MOUSEEVENTF_ABSOLUTE = &H8000 'absolute move
Private Const MOUSEEVENTF_LEFTDOWN = &H2 'left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 'left button up
Private Const MOUSEEVENTF_MIDDLEDOWN = &H20 'middle button down
Private Const MOUSEEVENTF_MIDDLEUP = &H40 'middle button up
Private Const MOUSEEVENTF_RIGHTDOWN = &H8 'right button down
Private Const MOUSEEVENTF_RIGHTUP = &H10 'right button up
Dim p As POINT
--------------------------------------------------------------------------------
2. Add the following code in a button procedure:
--------------------------------------------------------------------------------
Private Sub cmdOK_Click()
'move cursor
Call SetCursorPos(400, 300)
'find cursor position
Call GetCursorPos(p)
'mouse click
Call mouse_event(MOUSEEVENTF_LEFTDOWN, p.x, p.y, 0&, 0&)
Call mouse_event(MOUSEEVENTF_LEFTUP, p.x, p.y, 0&, 0&)
End Sub
vb: how to use treeview and child node?
This site provides users with the information about vb, visual basic, vb6, use treeview, how to use treeview, treeview node, child node, how to add child node, example, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to use treeview and child node in vb?
The TreeView control has a lot of options, but here is the basics of TreeView to get you started. The following is the syntax for adding a node:
TreeView1.Nodes.Add Relative, Relationship, Key, Text, Image, SelectedImage
You should be clear that all of the above parameters are optional, but you should know where the new item goes by using Relative and Relationship. Relative defines a relation, or an existing node, to the new node you are creating, while Relationship defines how the new node is related to this existing node. The following is a little reference of relationships for you:
tvwChild: new node is a child (one level down) of the specified node
tvwFirst: new node is first, at the same level of the specified node
tvwLast: new node is last, at the same level of the specified node
tvwNext: new node is after (at the same level) the specified node
tvwPrevious: node is before (at the same level) the specified node
You should also note that a TreeView gets its images from an ImageList, that is, if you want to add images, you need to add a ImageList control. The following is a little reference for ImagList:
1. In design mode, draw ImageList icon onto your Form.
2. Right-click on the ImageList and select Properties.
3. Choose the Images property page.
4. Click the Insert Picture button.
5. After selecting a picture file, add a unique key into the Key field.
6. Use the above syntax to add images.
The following is the code, example, steps for creating a TreeView in vb:
--------------------------------------------------------------------------------
1. In Component, add Microsoft Windows Common Controls 6.0
2. Go to design mode.
3. After seeing TreeView on Toolbox, drag the TreeView onto your form.
4. Once you have the TreeView, you can populate it in programming.
Add the following code in form_load.
Private Sub Form_Load()
TreeView1.Nodes.Add , , "root", "Root"
TreeView1.Nodes.Add "root", tvwChild, "child1", "Child1"
TreeView1.Nodes.Add "root", tvwChild, "child2", "Child2"
TreeView1.Nodes.Add "child1", tvwChild, "child_child1", "Child of Child1"
TreeView1.Nodes.Add "child2", tvwChild, "child_child2", "Child of Child2"
'add the following if you want Child1 of Child1 and Child1 of Child2 visible
TreeView1.Nodes("child_child1").EnsureVisible
TreeView1.Nodes("child_child2").EnsureVisible
End Sub
5. Add the following code in NodeClick if you want to perform
a specific task when you click it.
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
If Node.Text = "Child of Child1" Then
MsgBox "Child of Child1"
ElseIf Node.Text = "Child of Child2" Then
MsgBox "Child of Child2"
End If
End Sub
--------------------------------------------------------------------------------
If you think that this site is helpful, please recommend your friends to visit our site.
How to use treeview and child node in vb?
The TreeView control has a lot of options, but here is the basics of TreeView to get you started. The following is the syntax for adding a node:
TreeView1.Nodes.Add Relative, Relationship, Key, Text, Image, SelectedImage
You should be clear that all of the above parameters are optional, but you should know where the new item goes by using Relative and Relationship. Relative defines a relation, or an existing node, to the new node you are creating, while Relationship defines how the new node is related to this existing node. The following is a little reference of relationships for you:
tvwChild: new node is a child (one level down) of the specified node
tvwFirst: new node is first, at the same level of the specified node
tvwLast: new node is last, at the same level of the specified node
tvwNext: new node is after (at the same level) the specified node
tvwPrevious: node is before (at the same level) the specified node
You should also note that a TreeView gets its images from an ImageList, that is, if you want to add images, you need to add a ImageList control. The following is a little reference for ImagList:
1. In design mode, draw ImageList icon onto your Form.
2. Right-click on the ImageList and select Properties.
3. Choose the Images property page.
4. Click the Insert Picture button.
5. After selecting a picture file, add a unique key into the Key field.
6. Use the above syntax to add images.
The following is the code, example, steps for creating a TreeView in vb:
--------------------------------------------------------------------------------
1. In Component, add Microsoft Windows Common Controls 6.0
2. Go to design mode.
3. After seeing TreeView on Toolbox, drag the TreeView onto your form.
4. Once you have the TreeView, you can populate it in programming.
Add the following code in form_load.
Private Sub Form_Load()
TreeView1.Nodes.Add , , "root", "Root"
TreeView1.Nodes.Add "root", tvwChild, "child1", "Child1"
TreeView1.Nodes.Add "root", tvwChild, "child2", "Child2"
TreeView1.Nodes.Add "child1", tvwChild, "child_child1", "Child of Child1"
TreeView1.Nodes.Add "child2", tvwChild, "child_child2", "Child of Child2"
'add the following if you want Child1 of Child1 and Child1 of Child2 visible
TreeView1.Nodes("child_child1").EnsureVisible
TreeView1.Nodes("child_child2").EnsureVisible
End Sub
5. Add the following code in NodeClick if you want to perform
a specific task when you click it.
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
If Node.Text = "Child of Child1" Then
MsgBox "Child of Child1"
ElseIf Node.Text = "Child of Child2" Then
MsgBox "Child of Child2"
End If
End Sub
--------------------------------------------------------------------------------
vb: how to use common dialog control - Open, Save As box?
This site provides users with the information about vb, visual basic, vb6, common dialog control, how to use common dialog control, common dialog box, display open dialog box, show save as dialog box, common dialog box filter, get file name, example, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to use common dialog control in vb?
The following is the code, example to create open, save as dialog box with filter and also show how to get file name from common dialog control in vb:
--------------------------------------------------------------------------------
CommonDialog1.FileName = App.Path & "\*.*" 'show all file names
'CommonDialog1.InitDir = App.Path
'Specify default filter.
CommonDialog1.Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt
|html Files (*.html)|*.html"
CommonDialog1.FilterIndex = 2 ' Display the Open dialog box.
CommonDialog1.ShowOpen
'CommonDialog1.FilterIndex = 1 ' Display the SaveAs dialog box.
'CommonDialog1.ShowSave 'open save as
FileName = CommonDialog1.FileName 'get file name
Open FileName For Append As #1
Print #1, "This is the appended line"
Close #1
--------------------------------------------------------------------------------
If you think that this site is helpful, please recommend your friends to visit our site.
How to use common dialog control in vb?
The following is the code, example to create open, save as dialog box with filter and also show how to get file name from common dialog control in vb:
--------------------------------------------------------------------------------
CommonDialog1.FileName = App.Path & "\*.*" 'show all file names
'CommonDialog1.InitDir = App.Path
'Specify default filter.
CommonDialog1.Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt
|html Files (*.html)|*.html"
CommonDialog1.FilterIndex = 2 ' Display the Open dialog box.
CommonDialog1.ShowOpen
'CommonDialog1.FilterIndex = 1 ' Display the SaveAs dialog box.
'CommonDialog1.ShowSave 'open save as
FileName = CommonDialog1.FileName 'get file name
Open FileName For Append As #1
Print #1, "This is the appended line"
Close #1
--------------------------------------------------------------------------------
Tuesday, September 13, 2011
vb: how to create popup, right click menu?
This site provides users with the information about vb, visual basic, vb6, create popup menu, create right click menu, how to create popup menu, how to create right click menu, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to create popup, right click menu in vb?
The following is the code and steps to create popup, right click menu in vb:
--------------------------------------------------------------------------------
1. Create menu-options
- Switch to Design if not
- choose Tools/Menu Editor
- make a option:
caption = Find
name = nmuFind
visible = False
- make some sub-options:
caption = &Find
name = mnuFind
index = 1
caption = &Test
name = mnuTest
index = 2
- click On OK
2. Add the code
- view code of the form
- choose For Object = mnuFind
- add the following code:
Private Sub mnuFind_Click(Index As Integer)
MsgBox "this is find"
End Sub
- choose For Object = mnuTest
- add the following code:
Private Sub mnuTest_Click(Index As Integer)
MsgBox "this is test"
End Sub
3. Make the popup happen
- add the following code in the MouseDown Event
Private Sub Form_MouseDown(Button As Integer,
Shift As Integer, X As Single, Y As Single)
If Button = 2 Then Me.PopupMenu File
End Sub
4. press F5 and test it by right clicking on form
If you think that this site is helpful, please recommend your friends to visit our site.
How to create popup, right click menu in vb?
The following is the code and steps to create popup, right click menu in vb:
--------------------------------------------------------------------------------
1. Create menu-options
- Switch to Design if not
- choose Tools/Menu Editor
- make a option:
caption = Find
name = nmuFind
visible = False
- make some sub-options:
caption = &Find
name = mnuFind
index = 1
caption = &Test
name = mnuTest
index = 2
- click On OK
2. Add the code
- view code of the form
- choose For Object = mnuFind
- add the following code:
Private Sub mnuFind_Click(Index As Integer)
MsgBox "this is find"
End Sub
- choose For Object = mnuTest
- add the following code:
Private Sub mnuTest_Click(Index As Integer)
MsgBox "this is test"
End Sub
3. Make the popup happen
- add the following code in the MouseDown Event
Private Sub Form_MouseDown(Button As Integer,
Shift As Integer, X As Single, Y As Single)
If Button = 2 Then Me.PopupMenu File
End Sub
4. press F5 and test it by right clicking on form
html: how to highlight, clear all text when click on it ?
This site provides users with the information about html highlight when click, how to highlight all text when click textarea, highlight when click text field, how to clear all text on click in textarea, how to clear all text on click in text field, example, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
It is very easy to highlight, clear all the text in textarea or text field when you click on it. The following are the simple examples:
1. Highlight all the text in textarea or text field when click on it
< form>
< textarea cols=25 rows=8 onFocus="this.select()">This is a test< /textarea>
< /form>
2. Clear all the text in textarea or text field when click on it
< form>
< textarea cols=25 rows=8 onclick="this.value=''" >This is a test< /textarea>
< /form>
If you think that this site is helpful, please recommend your friends to visit our site.
It is very easy to highlight, clear all the text in textarea or text field when you click on it. The following are the simple examples:
1. Highlight all the text in textarea or text field when click on it
< form>
< textarea cols=25 rows=8 onFocus="this.select()">This is a test< /textarea>
< /form>
2. Clear all the text in textarea or text field when click on it
< form>
< textarea cols=25 rows=8 onclick="this.value=''" >This is a test< /textarea>
< /form>
Java: how to read and write array?
This site provides users with the information about java, read array, write array, how to read array, how to write array, get data from array, set data to array, how to get data from array, how to set data to array, multi-dimensional arrays, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
Java: how to read and write array?
The following is the simple example to read and write array in java programming:
If you think that this site is helpful, please recommend your friends to visit our site.
Java: how to read and write array?
The following is the simple example to read and write array in java programming:
1. Basic array in Java
--------------------------------------------------------------------------------
import java.util.*;
public class array{
public static void main(String[] args){
int[] t_array = new int[10];
//Write data to array
for (int i = 0; i < t_array.length; i++)
{
t_array[i] = i;
}
int sum = 0;
//Read data from array
for (int i = 0; i < t_array.length; i++)
{
sum += t_array[i];
}
System.out.println(sum);
}
--------------------------------------------------------------------------------
2. Multi-dimensional arrays in Java
--------------------------------------------------------------------------------
import java.util.*;
public class array{
public static void main(String[] args){
int[][] m_array = new int[8][6];
for (int i=0; i < m_array.length; i++)
{
for (int j=0; j < m_array[i].length; j++)
{
System.out.print(" " + m_array[i][j]);
}
System.out.println("");
}
}
java: how to read file, append file, write file?
This site provides users with the information about java, read file, write file, how to read file, how to write file, read entire file, how to save file, how to retrieve file, retrieve data from file, save data to file, append file, how to append data to file, read file character by character, StringTokenizer, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to read file, append file, and write file in java?
The following is the code to retrieve data from file, append data to file, and save data to file in java:
If you think that this site is helpful, please recommend your friends to visit our site.
How to read file, append file, and write file in java?
The following is the code to retrieve data from file, append data to file, and save data to file in java:
--------------------------------------------------------------------------------
package test;
/**
* Title: test
* Description:
* Copyright: Copyright (c) 1994-2011. www.edusoftmax.com
* Company:
* @author
* @version 1.0
*/
import java.io.*;
import java.util.*;
public class test {
public static void main (String args[])
{
FileOutputStream out; // declare a file output object
//FileInputStream in;
DataInputStream in; // = new DataInputStream(fstream);
PrintStream p; // declare a print stream object
try
{
// Create a new file output stream
out = new FileOutputStream("c:\\test.txt");
// Connect print stream to the output stream
p = new PrintStream( out );
p.println ("linda,smith");
p.close();
// file append
FileWriter myWriter = new FileWriter("c:\\test.txt", true);
myWriter.write("\n" + "String to be appended." );
myWriter.close();
FileInputStream fstream = new FileInputStream("c:\\test.txt");
in = new DataInputStream(fstream);
String line = null;
int wordCount = 0;
while ((line = in.readLine()) != null)
{
//use StringTokenizer to read comma delimited file or string
StringTokenizer st = new StringTokenizer(line, ",");
while (st.hasMoreTokens())
{
System.out.println("The first character of word " + (++wordCount) +
" is: " + st.nextToken().substring(0,1));
}
}
in.close();
}
catch (Exception e)
{
System.err.println ("Error writing to file");
}
}
}
--------------------------------------------------------------------------------
For reading file character by character, you can use the following code:
--------------------------------------------------------------------------------
import java.io.*;
public class ReadFileChar {
public static void main(String[] args) throws IOException
{
BufferedReader in = null;
int ich;
char ch;
int char_count=0;
// read character from test file
in = new BufferedReader( new FileReader( "c:\\test.txt" ));
while ( (ich=in.read()) != -1)
{
// extract character
ch = (char) ich;
char_count++;
System.out.println( "count = " + char_count + " int = " + ich +
" char = " + ch );
}
in.close();
}
}
Sunday, September 11, 2011
vb: how to call command button without click it?
This site provides users with the information about vb, visual basic, vb6, visual basic 6, call command button without click it, how to call command button without click it, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
vb: how to call command button without click it?
There are two ways that you can use to call command button without clicking it. The following is how to:
1. Use the following:
Command1 = True
2. Use the following:
Call Command1_Click
or
Command1_Click
Note: The above is based on the following procedure
Private Sub Command1_Click()
'test
End Sub
If you think that this site is helpful, please recommend your friends to visit our site.
vb: how to call command button without click it?
There are two ways that you can use to call command button without clicking it. The following is how to:
1. Use the following:
Command1 = True
2. Use the following:
Call Command1_Click
or
Command1_Click
Note: The above is based on the following procedure
Private Sub Command1_Click()
'test
End Sub
vb: how to get inputbox value?
This site provides users with the information about vb, visual basic, vb6, get input box value, how to get inputbox value, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
vb: how to get inputbox value?
The following is the way to get the inputbox value in visual basic programming:
Dim v As Integer
v = Val(InputBox("Please type the value.", "Input Value"))
MsgBox v
If you think that this site is helpful, please recommend your friends to visit our site.
vb: how to get inputbox value?
The following is the way to get the inputbox value in visual basic programming:
Dim v As Integer
v = Val(InputBox("Please type the value.", "Input Value"))
MsgBox v
vb: how to read and write array?
This site provides users with the information about vb, visual basic, vb6, how to read array, how to write array, use array to add value, use array to read value, how to use array to add, get value, read static array, write static array, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
vb: how to read and write array?
The following is the way to read and write array in visual basic programming:
Private Sub Command6_Click()
Dim LinesArr() As String
ReDim LinesArr(50)
Dim tmp As Integer
Dim LinesRead As Integer
LinesRead = 0
Open App.Path & "\sorteddate.txt" For Input As #1
Do While Not EOF(1)
If LinesRead = UBound(LinesArr) Then
ReDim Preserve LinesArr(UBound(LinesArr) + 50)
End If
'read a line
Line Input #1, LinesArr(LinesRead)
LinesRead = LinesRead + 1
DoEvents
Loop
'redim to actual size
ReDim Preserve LinesArr(LinesRead - 1)
Close #1
For tmp = 0 To UBound(LinesArr)
MsgBox LinesArr(tmp)
Next tmp
End Sub
Use of static array as follows:
Dim tmp As Integer
tmp1 = "001121"
tmp2 = "001122"
tmp3 = "001123"
Dim mArray, mDay
mArray = Array(tmp1, tmp2, tmp3)
' Return values assume lower bound set to 1
' (using Option Base statement).
'mDay = mWeek(2) ' mDay contains "Tue".
'mDay = mWeek(4) ' mDay contains "Thu".
For tmp = 0 To UBound(mArray)
MsgBox mArray(tmp)
Next tmp
If you think that this site is helpful, please recommend your friends to visit our site.
vb: how to read and write array?
The following is the way to read and write array in visual basic programming:
Private Sub Command6_Click()
Dim LinesArr() As String
ReDim LinesArr(50)
Dim tmp As Integer
Dim LinesRead As Integer
LinesRead = 0
Open App.Path & "\sorteddate.txt" For Input As #1
Do While Not EOF(1)
If LinesRead = UBound(LinesArr) Then
ReDim Preserve LinesArr(UBound(LinesArr) + 50)
End If
'read a line
Line Input #1, LinesArr(LinesRead)
LinesRead = LinesRead + 1
DoEvents
Loop
'redim to actual size
ReDim Preserve LinesArr(LinesRead - 1)
Close #1
For tmp = 0 To UBound(LinesArr)
MsgBox LinesArr(tmp)
Next tmp
End Sub
Use of static array as follows:
Dim tmp As Integer
tmp1 = "001121"
tmp2 = "001122"
tmp3 = "001123"
Dim mArray, mDay
mArray = Array(tmp1, tmp2, tmp3)
' Return values assume lower bound set to 1
' (using Option Base statement).
'mDay = mWeek(2) ' mDay contains "Tue".
'mDay = mWeek(4) ' mDay contains "Thu".
For tmp = 0 To UBound(mArray)
MsgBox mArray(tmp)
Next tmp
Subscribe to:
Posts (Atom)
For other hundreds of computer repair tips, tricks, tweaks, guide, help, please go to
http://website.edusoftmax.com