Jump to content
xisto Community
Sign in to follow this  
bridenhosen

Visual Basic Help need help useing visual basic

Recommended Posts

Refer to following articles for more information:

http://visualbasic.about.com/od/

http://www.eastcoastgames.com/VBA/Intro.htm

http://forums.xisto.com/no_longer_exists/ (very good and comprehensive presentation)

http://www.vb-helper.com/index_multimedia.html (animation section)

As far as I know, you can create an animated gif image or flash file then embed them into VB form. Here is one of many tutorials on the net http://www.anim-fx.com/flash-tutorials/insertvb6.html

Share this post


Link to post
Share on other sites

Note for beginers, the words placed in single quotation marks are comments

Heheheh. This is easy. Very easy.

 

Quick Solutions

 

In VB6, you just need the default controls. Importantly, the Image control (not picture control using that would kill the cpu) and a Timer control.

 

Prepare the slides of the animation. You could do this by taking frame by frame shots of a movie, gif animation, etc. Best way to experiment is with... STICK FIGURES!!! (fine, be Van Goh if you want. But you'll die at frame 3)

 

Rename the frames from 1 to say 32 same file extentions (say .bmp) put it in a folder called Animation1/

Then, create one image control (I hereby declare this control by its default name, Image1).

Next, add the Timer Control (blah blah blah as above, Timer1)

Set the timer's interval. This will become the the animation's frame interval.

Set the timer's enabled to false if you want to pause it, set to true for resuming.

 

Then add this nifty code to the same form as the controls:

Dim ImgCounter as Integer 'Use Long if you plan to make a movie out of this'Private Const AniMax as Integer = 33 'Change the number if you like (last frame + 1)'Private sub Timer1_Timer()ImgCounter = ImgCounter + 1Image1.Picture = LoadPicture(App.Path & "/Animation1/" & Trim(Str(ImgCounter)) & ".bmp" 'change file extention if necessary')If ImgCounter = AniMax ThenImgCounter = 0 'Not 1 or else the next time this function repeats, it'll skip frame 1'End IfEnd SubPublic Function Frame_GoTo(iFrame as Integer)If iFrame < AniMax  And iFrame > 0 ThenImgCounter = iFrameImage1.Picture = LoadPicture(App.Path & "/Animation1/" & Trim(Str(ImgCounter)) & ".bmp")End IfEnd Function

There. With the extra function you can go to any frame within the range by calling it up. You do this by entering the code:

Frame_GoTo('frame no.')

Ta da! The simple animation ready to roll.

 

Second Alternative: Create a .avi, .mpeg or .mp4 file and embed it with the program. Instant animaiton. Eats the RAM though, so be careful.

Share this post


Link to post
Share on other sites

As far as I know, you can create an animated gif image or flash file then embed them into VB form.

the visual studio 2005 professional version comes with animations that have to be installed as a optional item. They include all of the animations that were used in earlier versions of windows and include ones like the file copy dialog, file delete, upload to ftp, download files et etc. They are pretty simple but it that is something you are looking for, they can be useful.

because they are so large i cannot post them here on the board, but i will try and put them up on my Xisto site. ill reply again when they are up! the zipped version is rather large (2.03MB) so be warned!

also, since you can embed almost any gif animation into a vb form then any animated gif that you come across on the internet you could possibly use. There are many sites (i wont list them now, but do some googling and you'll find some) that give away animations for royalty-free use.

but remember, the more animations and pictures that you add to your forms, the slower the form is going to become to load which will in effect slow down your entire application, so use wisely!

good luck
-jimmy

Share this post


Link to post
Share on other sites

where is my mistake?

Visual Basic Help

 

I'm trying to complete this code and I'm getting the code from the book.

The code is: Private Sub Form_Load()

' Initialize the label's text

Dim strLabel1 As String

Dim strLabel2 As String

Dim StrLabel3 As String

Dim StrLabel4 As String

 

StrLabel1 = "use frames if you want"

StrLabel2 = " to group options together"

StrLabel3 = " Each frame forms one set"

StrLabel4 = " of option buttons"

 

LblFrames.Caption= strLabel1&strLabel2&strLabel3&strLabel4

 

End Sub

 

Now the problem is with the last line , it didn't accept the ampersand after every string name . If you can help with that , please reply. Thank you

 

-question by new student

Share this post


Link to post
Share on other sites

where is my mistake?

 

Visual Basic Help

I'm trying to complete this code and I'm getting the code from the book.

The code is: Private Sub Form_Load()

' Initialize the label's text

Dim strLabel1 As String

Dim strLabel2 As String

Dim StrLabel3 As String

Dim StrLabel4 As String

 

StrLabel1 = "use frames if you want"

StrLabel2 = " to group options together"

StrLabel3 = " Each frame forms one set"

StrLabel4 = " of option buttons"

 

LblFrames.Caption= strLabel1&strLabel2&strLabel3&strLabel4

 

End Sub

 

Now the problem is with the last line , it didn't accept the ampersand after every string name . If you can help with that , please reply. Thank you

 

-question by new student


The solution is very simple, just add spaces between the string names and the & signs, like this:

 

LblFrames.Caption = strLabel1 & strLabel2 & strLabel3 & strLabel4

Share this post


Link to post
Share on other sites
Visual Basic, Run-time error Visual Basic HelpVisual Basic, Run-time error '-1 (ffffffff) 'ENGLISHHistory:1)A program that I developed with VB6 runs perfectly in my old computerin programing way and in executable way, with a Pentium(are) 4 CPU 1,6GHz, Window XP.2) Now I have a new computer with Intel Core™2D core, E7300 2,66 GHz, Window XP, when running the program in programway it works during one time but suddenly he gives the suitable error,Run-time error ` -1 (ffffffff) ' and the strange is that whenrequesting help the system doesn't respond and I have to cancel it.Nevertheless if I work on my new PC with the executable (*.Exe) of the same program this works and doesn't give errorESPAÑOLHistoria1)Unprograma que desarrollè con VB6 corre perfectamente en mi viejacomputadora en modo de programaciòand y en modo ejecutable, con unPentium(are) 4 CPU 1,6 GHz, Window XP.2) Ahora tengo una nuevacomputadora con Intel Core™ 2D core, E7300 2,66 GHz. Window XP, alcorrer el programa en modo de programaciòand, èste trabaja durante untiempo pero repentinamente the el error indicado, Rin-time error `-1(ffffffff)' y lo màs extraño es que al solicitar ayuda el sistema noresponde y tengo que cancelarlo.No obstante si trabajo en mi nueva PC con el ejecutable del mismo programa este trabaja bièand y no the error.-reply by Ernesto Gramcko

Share this post


Link to post
Share on other sites
help vb6 browser webVisual Basic Help

Hy,

I have just made a browser web in vb6 and  I don't know how to add favorites? Any ideas please ???  I have found ideas about adding favorites but in vb.Net

-reply by miha

Share this post


Link to post
Share on other sites

Determine the average number of letters in the words of a sentence.Visual Basic HelpI am trying to debug this to find and correct the errors. Please Help. Thank you.

 

Here is the code:

 

Private Sub btnCount_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCount.Click		'Determine word count and average letters / word in the sentence		Dim iLength As Integer		  'length of string		Dim iWords As Integer		   'number of words in sentence		Dim iLetterCount As Integer	 'count of letters		Dim sWord As String			 'current word		Dim sPrevLetter As String	   'previous letter		Dim x As Integer				'loop counter		Dim sLetter As String		   'current letter from sentence		Dim sLine As String = txtInput.Text.Trim.ToLower	'entered text  - no leading or trailing spaces - make all lowercase		Try			iLength = sLine.Length			If iLength = 0 Then				'nothing entered				MessageBox.Show("Please enter a sentence.")			Else			End If			sWord = ""			sPrevLetter = ""			For x = 0 To iLength				sLetter = sLine.Chars(x)  'get Next Letter				Select Case sLetter					Case "a" To "z"						'we are in a word - increment letter counter						sWord &= sLetter					Case Else						'we are in a break between words						If sPrevLetter <> " " Then  'we don't want to count succesive spaces as a word							'add word to list							lstLetters.Items.Add(sWord)							sWord = ""  'reset for next word						End If				End Select				sPrevLetter = sLetter			Next			If sWord <> "" Then				lstLetters.Items.Add(sWord)			End If		Catch ex As Exception			MessageBox.Show(ex.Message)		End Try		lblWordCount.Text = "Words Counted: " & lstLetters.Items.Count		lblAverage.Text = "Average letters per word: " & iLetterCount / iWords	End Sub	Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click		'clear all display and input controls		txtInput.Clear()	End Sub	Private Sub txtInput_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtInput.TextChanged	End SubEnd Class
Edited by moderator (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.