Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




How Do I Continue Entry


Hi
I want to enter data to an excell sheet. I have made the connectivity and used datacontrol to do so. But my entry spreads through 6 pages. That is i have to enter data for six pages one after the other. Should I use update method at the end, in the last form, or as I goto the next page. And is there any new method for adding data to an excell sheet, because it is giving errors, asking for an addnew method.

Thanx DHI




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Check If Your Next Entry Is Equal To The Previous Entry
hi,
im doing an accounting system where i can input my transaction debit and credit...as we all know, these values must be equal as entered..now i want to trap whether the user input another value other that what he input on the previous entry...

here's my code:


Code:


Private Sub cmdOK_Click()
Dim dcRS As New ADODB.Recordset

strSQL = "Select * from tblEntry Where TransID like '" & trans_id.Caption & "'"
Call SelSQL(strSQL, dcRS)

If optdebit.Value = True Then
dcRS.AddNew
dcRS!TransID = trans_id.Caption
dcRS!Entries = txtTitle
dcRS!Debit = txtAmount
dcRS!Credit = 0
dcRS.Update

ElseIf optcredit.Value = True Then


dcRS.AddNew
dcRS!TransID = trans_id.Caption
dcRS!Entries = txtTitle
dcRS!Debit = 0
dcRS!Credit = txtAmount
dcRS.Update

End If

MsgBox "Transaction saved", vbInformation
Set DataGrid1.DataSource = dcRS

Private Sub Form_Load()
Dim lRS As New ADODB.Recordset

Call DataOpen(goConn)
Call LoadDataComboBox("tblAccountEntry", dbCode)

strSQL = "Select * from tblEntry Where TransID like '" & trans_id.Caption & "'"
lRS.Open strSQL, goConn, adOpenDynamic, adLockOptimistic

If Not lRS.EOF Then lRS.MoveLast
Set DataGrid1.DataSource = lRS

End Sub

End Sub


in this code i can input the data but i cant seem to trap the value of the debit if it is equal to credit on my next entry...my controls are optcredit,optdebit (radio buttons), txtamount and a command button....anyone can show me how?? thanks

Sub Won't Continue?
I've got a program in the making that utilizes the WebBrowser component. Here's my code:


Code:
Dim NextTorrent As Boolean
Private boComplete As Boolean
Private boState As Boolean
Dim FORCEquit As Boolean

Private Sub UploadBiteNova()
NextTorrent = False
If Form1.MUSIC.Value = True Then
If NextTorrent = True Then Exit Sub
wb.Document.All("type").Value = "94"
End If
If Form1.MOVIE.Value = True Then
If NextTorrent = True Then Exit Sub
wb.Document.All("type").Value = "67"
End If
If Form1.EBOOK.Value = True Then
If NextTorrent = True Then Exit Sub
wb.Document.All("type").Value = "112"
End If
If Form1.OTHER.Value = True Then
If NextTorrent = True Then Exit Sub
wb.Document.All("type").Value = "112"
End If
If Form1.TVSHOW.Value = True Then
If NextTorrent = True Then Exit Sub
wb.Document.All("type").Value = "276"
End If
If Form1.SOFTWARE.Value = True Then
If NextTorrent = True Then Exit Sub
wb.Document.All("type").Value = "124"
End If
wb.Document.All("torrent").Click
wb.Document.All("filename").Value = Form1.Title.Text
wb.Document.All("reg", "1").Click
Do Until NextTorrent = True
If NextTorrent = True Then Exit Sub
If FORCEquit = True Then Exit Sub
DoEvents
Loop

End Sub

Private Sub NextButton_Click()
NextTorrent = True
End Sub

Private Sub Timer1_Timer()
Timer1.Enabled = False
FORCEquit = False
NextTorrent = False
boState = False
boComplete = False
Form1.LAUNCHwb.Enabled = False
Form1.Title.Enabled = False
Form1.Description.Enabled = False

If Form1.BITENOVA.Value = Checked Then
wb.Navigate "http://www.bitenova.nl/upload"
Do Until boComplete = True
If FORCEquit = True Then Exit Sub
DoEvents
Loop
boComplete = False
Call UploadBiteNova
Do Until boComplete = True
If FORCEquit = True Then Exit Sub
DoEvents
Loop
boComplete = False
End If

Private Sub wb_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If boState = False Then
boComplete = True
End If
End Sub

Now the problem is, is that if the user clicks NextButton during the UploadBiteNova sub, it won't do anything UNLESS the user has clicked something on the WebBrowser first. How can I make it so that if the user presses next, it will end the sub at ANY point in the sub and continue with what was going on in the Timer1_Timer sub??

Continue To Dll, How Do U Do It...
Option Explicit
Private Fnc As Helper.Help

Private Sub Form_Activate()
Set Fnc = New Helper.Help
MsgBox Str(Fnc.Number_Of_Words("effr efaer we"))
End Sub

how come i get "overflow" for the above?

helper is the DLL, help is the CLASS inside the dll,
how come i need to type : fnc as helper.help and not only
fnc as helper ?

Continue?
C has the ever so great keyword, continue, is there an equivalent in Visual Basic? I just find it to be easy when in a For..Next loop to be able to have continue go to the Next element in the loop without having to have hug if blocks.

Thanks
Ian

Setup Cannot Continue....
All,

I've a funny installation problem concerning the P&D Wizard. I recently had to rebuild my laptop. Previous to the rebuild, users were having no problems installing my vb6 application that I package using the P&D Wizard. After the rebuild, I've had three users report that, when installing, they were getting the following message, "Setup cannot continue because some system files are out of date on your system. Click OK if you would like setup to update these files for you now....." It's a familiar message that users used to get back on Win2K and NT systems; however, I've never had it reported on XP box.

Two of my users solved the problem by ugrading XP from SP1 to SP2. A third user, however, still cannot get past the message, even though she's on XP SP2.

Upon digging, I found that several system files listed in the SETUP.LST file of the a deployment package created BEFORE my system rebuild are much older than the system files listed in the SETUP.LST file of a deployment package created AFTER my system rebuild. Here are the files and their dates:

Old New
COMDLG32.OCX5/22/00 4:58:00 PM3/9/04 1:00:00 AM
msado27.tlb8/4/04 4:00:00 AM 4/13/08 1:26:10 PM
MSCOMCTL.OCX12/20/02 2:02:44 PM3/9/04 1:00:00 AM
MSFLXGRD.OCX5/22/00 4:58:12 PM3/9/04 1:00:00 AM
MSSTDFMT.DLL4/3/00 8:05:58 PM 2/23/04 1:00:00 AM
msvbvm60.dll6/20/03 3:05:04 AM4/13/08 8:12:00 PM
odbccp32.dll8/4/04 4:00:00 AM 4/13/08 8:12:02 PM
scrrun.dll 8/4/04 4:00:00 AM 5/9/08 6:53:40 AM
TABCTL32.OCX12/6/00 1:02:36 PM3/9/04 1:00:00 AM

If I remember correctly, the "Setup cannot continue..." message was a result of vb6 packaging file versions that were "too new" for some worksations and the the resolution was to package older versions of the files.

Would anyone know why my vb6 installer suddenly wants to package newer files? I'm kinda thinking this is the problem my user is experiencing.

Thanx for any help!

Can'e Continue Setup.exe
hi
i have one vb application and created its setup file for deployment to client pc using packege wizard.
its perfectly installed to my developement pc but when i sun this setup of client pc to install there its give me following error
http://img265.imageshack.us/img265/9123/39873611jy3.jpg


after this when i click OK button setup ask me to restart my pc and after restarting the my windows nothing happens.
When i again start my setup after restarting my computer it again gimme above error.

so can you help me how to solve this.????

Why Does He Continue Running?
I succeded open the new form from the old one!!!
but the old one is continue running!!!, the new form is modal.
i use the vba of access in this code:

sub click()
docmd.openform ("newform")
(the new form is modal in is properties)

forms!newform!text1.getfocus

if newform.text1 = "yes" then do something

end sub

the problem is that the oldform still running and i can't get the information from "text1"

yaniv

Break From 'if' To Continue 'next'
Hi all,

im writing some code which is roughly as follows:

for i=1 to 10

'do some code

if i=3 then
'do some code
next i
end if

'do some other code

next

the problem is with the 'next i'. im hoping the program would terminate the if-loop and continue with the next i without execting the code below the if-statement. i get a 'next without for' error if i program it like this. i know that in my example things are a little simplified and i could probably get around the if-condition (i=3) in another way in this example, but things in real life are a little more complicated...

thanks for any help!

How To Continue With 1 Or Skip With 0
I have a database I am referencing to for some VBE script.
Next I have my csv files I reference to for new information.
The entire data consisting of about 800 entries does not all have to be analized. So I was thinking if I could put a new column that represented an ON/OFF switch maybe it'd be easier.
so 1= DO, 0 = Skip onto next.


Code:
Sub main()
strDirPath = "C: est"
Set oFilesCollection = ListFiles(strDirPath)

For Each strFileName In oFilesCollection
Set wbCSV = Application.Workbooks.Open(FileName:=strDirPath & strFileName, _
Format:=2)
Call Check
wbCSV.Close
Next strFileName
End Sub

Sub Check()
Set Num = wbCSV.Sheets(1).Range("A1")
Windows("Master.xls").Activate
Sheets("Sheet1").Activate
For i = 1 To 1000
If Cells(i, 1).Value = Num Then
If Cells(i, 10).Value = 1 Then
Cells(i, 1).EntireRow.Select
Selection.Copy
Sheets("Sheet2").Activate
Range("A2").Select
ActiveSheet.Paste
Else
exit sub()
Exit For
End If

If i = 1001 Then
Exit Sub
End If

End Sub
Next

I tried this, but it doesn't work. That and sometimes when I quits (which is does even if its a 1 or a 0) then it quits my whole program instead of continuing onto the next file in the directory.

If Cell(1, 16) = 1 Then Continue?
I have a for that opens a file, copies the contents from a csv file, pastes it to sheet1 of Super.xls.
I then take the information from Sheet1 and compare it to workbook Master Sheet1. If this information exists, continue with the function. Otherwise quit and go onto next string and start over.

What if I don't want a compare to take place in the Master.xls workbook?
I could go down the list and set O6 to O350 as a 1 or 0.
With that I should be able to compare the value, and if value = 1 (true) then continue, Else Exit Function. Does this sound right?


Code:
Option Explicit

Function Adjust() As Boolean
On Error GoTo Error

Dim r As Long
Dim i As Long
Dim Num As Variant
Dim switch As Variant

Windows("Super.xls").Activate
Sheets("Sheet1").Select

Cells.Replace What:="Value Plus Line - ", Replacement:="", LookAt:=xlPart _
, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Columns("A:F").EntireColumn.AutoFit

For r = 1 To 190
If Cells(r, 1).Value = "Times" Then
Rows(r & ":" & r + 3).Select
Selection.Cut
Range("A201").Activate
ActiveSheet.Paste
Exit For
End If
Next

If i = 191 Then
Exit Function ' Back to start and continue on with next String
End If

Set Num = Range("A1")
Windows("Master.xls").Activate
Sheets("Sheet1").Activate
For i = 1 To 350
If Cells(i, 1).Value = Num Then
Cells(i, 1).EntireRow.Select
Selection.Copy
Windows("Super.xls").Activate
Range("a200").Select
ActiveSheet.Paste
Exit For
End If
Next

If i = 351 Then
Call del
Exit Function
End If

'only allow this line to execute if the function was completed successfully
Adjust = True
Finish:
Exit Function

Error:
Resume Finish

End Function
I tried the following, but it exited the function every time.

Code:
If Cells( i, 16).Value = 0 Then
Exit Function
Endif

Continue To Next Line?
hi all... just wanted to clarify something..... i'm not sure about the syntax of my sql code here.....


Code:
DatabaseConnection.Execute "CREATE TABLE " & txtTableName.Text & " (COC_No Char, Date_Of_COC Char, Date_Of_Expiry Char, _
Process Char, Officer_In_Charge Char, SCO_No Char, Model_No Char, Controlled_Goods Char, Product_Category Char);"
'cause my code is very long... so i need to continue the next line.... what is the syntax for it?

Learn VB 6 Or Continue To VB.net?
VB 6 or VB.net? What's the difference?
...or are there any big differences?

Continue With VB Or Start C++?
Hi All,

My name is Shuaib and I am 16 years old. I have been studying Visual Basic for over 3 years and I would class myself as a Intermediate/Advanced VB programmer. My objective is to become a very good programmer within the software development area. However, lately I have an important decision to make. Should I continue working with Visual Basic or should I now move on to a more powerful language such as C or C++. I have researched about programming and found that most commercial software on the shelves is made with either C or C++. My gut feeling tells me I should now move into C/C++ so that I can work towards a career in "proper" software development. Any thoughts, ideas or opinions would be greatly appreciated.

Thanks,
Shuaib


...only 16 years old...and programming till 4 in the morning!<P ID="edit"><FONT class="small"><EM>Edited by JDT on 08/07/01 01:27 AM.</EM></FONT></P>

Pause/Continue
Hi,
I'm quite new to using VB; I started using it to automate data-crunching tasks in Excel. I have such a program that takes quite a while to run (2 1/2 hrs or so; simple program -- lots of data.) But the program ties up my computer the entire time it's running. Is it possible to code a msgbox to come up every five minutes or so, ask if the user would like to pause or abort, and then, if there's no response for 10 seconds, continue on with execution of the program? Suggestions as to how to do this (or any functionally equivalent solution) would be greatly appreciated.

Continue A Loop
Hi,
Is there any statement to continue a For and While loop.
thanks

Continue With VB6 Or New Launguage?
I have always been very interested in programming, ever since I was a little kid, trying to program in Delphi at the age of 14, and later in VB5.

In the last year I have had Programming in school, a beginners class in VB6, but the teacher was so bad, and now I am lightyears better than him.
Now the school-year is over, and I am decent in VB6. My best projects have been a running sign/MSComm program and a fun little game.
You can see them here: Eksamens Projekt - Programmering.rar and Skydespil.rar

Now that I am done in school, and not forced to program in VB6 anymore, I need some guidence. Should I continue with programming in VB6, and if so, what should I make, or should I learn a new language, like VB.Net, C++ or C#?

- Thediabloman -

Can't Continue Setup.exe
hi
i have one vb application and created its setup file for deployment to client pc using packege wizard.
its perfectly installed to my developement pc but when i sun this setup of client pc to install there its give me following error
http://img265.imageshack.us/img265/9123/39873611jy3.jpg


after this when i click OK button setup ask me to restart my pc and after restarting the my windows nothing happens.
When i again start my setup after restarting my computer it again gimme above error.

so can you help me how to solve this.????

Continue Button
I have an order form. In this form you have to fill information. In this form there is a command button that says continue and its ENABLE is set to FALSE. how do i make the command button ENABLE set to TRUE after all the textboxes are filled out? and if the boxes are not filled i want a Msgbox that says Please Fill or something..thx!

How To Continue On The Next Line
i would like to know how do i keep typing on the next line , it's says on the line i was typing maximum reached so i want to continue it on the next link how do i do that?

tanks

Keyword 'continue' In C
wat is the keyword for 'continue' in c for vb?

Continue ReadLine?
Excuse me..appreciate for your big help here..
Question: My program below only able to detect the first keyword and then terminate the program. How can I let my program to continue to read the remaining line so that it will be able to detect the other keywords that exist in a file?

Look at my code here:

Dim Fsys As New FileSystemObject
Dim InStream As TextStream

TestFile = "a: ext1.txt"
Set InStream = Fsys.OpenTextFile(TestFile, 1, False, False)
While InStream.AtEndOfStream = False
RawdataStr = InStream.ReadLine

If InStr(RawdataStr, " keyword") <> 0 Then

'other code here'

End If

Wend
Set InStream = Nothing

Continue Processing
Hi Peps!

How can I make my code continue to process when I click and hold while the mouse is on the title bar of a window?

Continue In The Loop
i've a control array and two seperate controls.the code below shows me only one control which is not part of any array and exits.how can i continue further in the loop.


On Error GoTo err
Dim control As control
For Each control In Controls
Print control.Name & "is control in array and has an index" & control.Index
Next
Exit Sub
err:
Print control.Name & "is not in an array"

Continue Searching
This searches a text box. How can i get it to continue searching for the next words if it doesn't find a result?

Private Sub Command5_Click()
selct
copy
pste
Dim objSearch As Collection
Dim varSearch As Variant
Dim intPos As Integer

Set objSearch = New Collection
objSearch.Add "ccc"
objSearch.Add "aurora"
objSearch.Add "mining"

intPos = 0
For Each varSearch In objSearch

intPos = InStr(1, Text1.Text, varSearch)
If intPos > 0 Then
Open "C:File.txt" For Append As #1
Print #1, varSearch & " was found in (" & _
Text1.Text & ") at position " & intPos
Close #1
Else
MsgBox "no results"
End If
Next


End Sub

Press Any Key To Continue
I have a For/Next Loop

Within this loop I wish to have a pause.
When the pause occurs the message "Press Any Key to Continue" comes up

Thanking you in advance



Press Any Key To Continue...
I'm writing a program where a picture will post up on a form and a portion of some information will appear on the picture and on the form. But, I only want part of the information to appear at this time -- I want the rest of the information to appear when a button (any button) is pressed. I don't want to use a message box or an input box because I don't want anything on the screen.

1) Form/Picture appears with partial data -- a message at bottom of screen says "Press any key to continue." (I have this figured out just fine.)

2) The user presses any button and the remainder of the data appears on the picture and on the form. I'm using moving sprites to get the extra info on the picture. I'm using a Label on the form to get the new information posted. (These are no problem with the sprites or the label, I coded these just fine.)

The problem is getting from Step One to Step Two. I don't know how to code a KeyDown or a KeyPress (or something else???) so that it will accept ANYTHING that gets keyed by the user. Older basic used to have a "GetKey" function that just read the keyboard but I don't see any sort of function that equals this.

Any Ideas on how to do this?

Is There Any Equivalent For 'continue' Of C++ In Vb?
hi

  genreally in C++, suppose if we want to skip the some code in the loop we are using continue.
it will skip all the commands after that then it will increment the counter and reloop the loop.

Is there any equovalent in the Vb for this.or else how can i handle it.



thanks
---------------------------------------------
Srinivas.

Continue Only When Shell Is Done
How do you keep a program from continuing while a shell is carring out a process? I have always used a sub routeen that takes more time than the shell operation. This is cluggy. I would like to do it right. I need "code" that knows a shell window is open and waites until the operation is complete. My shell operation is set to 0 so it closes when its' operation is done. The program compresses a file and moves it to another folder. I want to check to see the file is there and delete the non compoessed original. If the program checks while the shell is moving the file it will not be there.

Thanks for any help

Continue; In A Loop, Like C++
Hi,
I am trying to figure out how to figure out how to skip some statements in a for loop and go back to the beginning..in a C++ for loop I can write:

for( int i = 0; i &lt; 20; i++)
{

//if some condition met
continue;

//more work here
}

if some condition becomes true, then the rest is skipped and execution goes back to the beginning of the loop again..in VB if I write

for i = 1 to 10

'if some condition met
'how to skip the rest of the loop and go up to the beginning ????

'more work here..

next


I need to skip back to the top if some condition is met. Sounds easy...but I can't find it.

Any help will be truly appreciated.

Regards,
Nas.










Find out what you like doing best and get someone to pay you for doing it.

Continue To Write At The End Of A Textfile?
Greetings!

I have a program, where I have two loops. The inner one, loops an amount of times to create a row of text. Then, it's applied into a textfile. After that, the outer loop will tell the inner loop to start all over, and more rows are supposed to be added into this textfile.
But here comes the problem. It simply overwrite the first text, so there will only be one row when the loops are finnished. I believe this is a hard topic, but I do wanna know what I can do to fix this. What I at least can say is: Every row will have the exactly same amount of characters, and I'm even able to pre-calculate them so I will know even before the looping starts off.

And here is the code for the textfile writing:


Code:
Public Function fnWriteToFile(Text As String)
Dim iNum As Integer
Dim isOpen As Boolean
On Error GoTo Felhantering

iNum = FreeFile()
Open "c: est.txt" For Output As #iNum
omOppen = True
Print #iNum, Text

Felhantering:
If isOpen Then Close #iNum
If Err Then Err.Raise Err.Number, , Err.Description

End Function
Anyone wish to give me some guidelines?


Regards,
Pedalen

Continue Will Movie Is Still Playing.
Hi folks,

How do game makers put in a intro movie in there game?

I've tried using DirectShow but for some reason when the movie is not done playing it continues to the menu. Both the menu and the movie are rendered. its really messy. What can i do about it?

greetz rein

How To Continue On After Calling Another Function
Is there a way to have VB go ahead and goto the next line of code even after it uses the CALL statement to go to another function?

I have my own arrays to keep up with my program so it will not get passed 10 iterations of my code (no stack error stuff).

Right now the actual code is like this:


Code:
Controller.RemoveItem ITCNum
Controller.AddItem Store, ITCNum

Call GetCloseoutLog(Store, ITCNum)

G = CurrentSpot
If CurrentSpot + 1 <= ListView1.ListItems.Count Then CurrentSpot = CurrentSpot + 1 Else CurrentSpot = 1

If I want the program to keep right on going passed the GetCloseoutLog sub, how could I do it? The sub takes about 5 or 6 seconds at times to complete as it is very long but I want to go ahead and keep on going so I can queue up 10 or so tasks...

I hope this makes sense.

Thanks everyone!

Abort / Continue After X Seconds
Hello.

I have file uploading that can take some time or be stucked.
Can I set X seconds for that operations and if the operation is not complete by this time, the program will go on (by goto or something else).

Can I set time for specific operation ?

thanks.

Making Music Continue
Hello everyone, I've gotten the music to play now I'm having trouble making the music continue. the problem is I choose for music to be on, the program randomly selects which file to play. When the song is finished, I want the program to randomly select another song and start playing that one. I want that to continue until the user selects music to be off.

My code is as follows:
' Plays music when selected
Public Sub mnumusicon_Click()

mnumusicoff.Checked = False
mnumusicon.Checked = True

Randomize
songnum = ((Rnd * 3) + 1)
gmusic(1) = App.Path & "gmusicstory.mid"
gmusic(2) = App.Path & "gmusic
everse.mid"
gmusic(3) = App.Path & "gmusicstopping.mid"
gmusic(4) = App.Path & "gmusicsoundtrk.mid"

mlist = gmusic(songnum)

media.mmOpen mlist
media.mmPlay
End Sub

'this is the class module I'm using to play the music. I'm pretty sure I'd have to use something here to make it loop.

Option Explicit

'-----------------------------------------------------
' Name : MMedia.cls
' Author : Peter Wright, For BG2VB4 & BG2VB5
'
' Notes : A multimedia class, which when turned
' : into an object lets you load and play
' : multimedia files, such as sound and
' : video.
'-----------------------------------------------------

' -=-=-=- PROPERTIES -=-=-=-
' Filename Determines the name of the current file
' Length The length of the file (Read Only)
' Position The current position through the file
' Status The current status of the object (Read Only)
' Wait True/False...tells VB to wait until play done

' -=-=-=- METHODS -=-=-=-=-
' mmOpen <Filename> Opens the requested filename
' mmClose Closes the current file
' mmPause Pauses playback of the current file
' mmStop Stops playback ready for closedown
' mmSeek <Position> Seeks to a position in the file
' mmPlay Plays the open file

'-------------------------------------------------------------
' NOTES
' -----
'
' Open a file, then play it. Pause it in response to a request
' from the user. Stop if you intend to seek to the start and
' play again. Close when you no longer want to play the file
'--------------------------------------------------------------

Private sAlias As String ' Used internally to give an alias name to
' the multimedia resource

Private sFilename As String ' Holds the filename internally
Private nLength As Single ' Holds the length of the filename
' internally
Private nPosition As Single ' Holds the current position internally
Private sStatus As String ' Holds the current status as a string
Private bWait As Boolean ' Determines if VB should wait until play
' is complete before returning.

'------------ API DECLARATIONS -------------
'note that this is all one code line:
Private Declare Function mciSendString Lib "winmm.dll" _
Alias "mciSendStringA" (ByVal lpstrCommand As String, _
ByVal lpstrReturnString As String, ByVal uReturnLength As Long, _
ByVal hwndCallback As Long) As Long

Public Sub mmOpen(ByVal sTheFile As String)

' Declare a variable to hold the value returned by mciSendString
Dim nReturn As Long

' Declare a string variable to hold the file type
Dim sType As String

' Opens the specified multimedia file, and closes any
' other that may be open
If sAlias <> "" Then
mmClose
End If

' Determine the type of file from the file extension
Select Case UCase$(Right$(sTheFile, 3))
Case "WAV"
sType = "Waveaudio"
Case "AVI"
sType = "AviVideo"
Case "MID"
sType = "Sequencer"
Case Else
' If the file extension is not known then exit the subroutine
Exit Sub
End Select
sAlias = Right$(sTheFile, 3) & Minute(Now)

' At this point there is no file open, and we have determined the
' file type. Now would be a good time to open the new file.
' Note: if the name contains a space we have to enclose it in quotes
If InStr(sTheFile, " ") Then sTheFile = Chr(34) & sTheFile & Chr(34)
nReturn = mciSendString("Open " & sTheFile & " ALIAS " & sAlias _
& " TYPE " & sType & " wait", "", 0, 0)
End Sub

Public Sub mmClose()
' Closes the currently opened multimedia file

' Declare a variable to hold the return value from the mciSendString
' command
Dim nReturn As Long

' If there is no file currently open then exit the subroutine
If sAlias = "" Then Exit Sub

nReturn = mciSendString("Close " & sAlias, "", 0, 0)
sAlias = ""
sFilename = ""

End Sub

Public Sub mmPause()
' Pause playback of the file

' Declare a variable to hold the return value from the mciSendString
' command
Dim nReturn As Long

' If there is no file currently open then exit the subroutine
If sAlias = "" Then Exit Sub

nReturn = mciSendString("Pause " & sAlias, "", 0, 0)

End Sub

Public Sub mmPlay()
' Plays the currently open file, from the current position

' Declare a variable to hold the return value from the mciSendString
' command
Dim nReturn As Long

' If there is no file currently open, then exit the routine
If sAlias = "" Then Exit Sub

' Now play the file
If bWait Then
nReturn = mciSendString("Play " & sAlias & " wait", "", 0, 0)
Else
nReturn = mciSendString("Play " & sAlias, "", 0, 0)
End If
End Sub

Public Sub mmStop()
' Stop using a file totally, be it playing or whatever

' Declare a variable to hold the return value from mciSendString
Dim nReturn As Long

' If there is no file currently open then exit the subroutine
If sAlias = "" Then Exit Sub

nReturn = mciSendString("Stop " & sAlias, "", 0, 0)

End Sub

Public Sub mmSeek(ByVal nPosition As Single)
' Seeks to a specific position within the file

' Declare a variable to hold the return value from the mciSendString
' function
Dim nReturn As Long

nReturn = mciSendString("Seek " & sAlias & " to " & nPosition, "", 0, 0)

End Sub

Property Get Filename() As String
' Routine to return a value when the programmer asks the
' object for the value of its Filename property
Filename = sFilename
End Property

Property Let Filename(ByVal sTheFile As String)
' Routine to set the value of the filename property, should the programmer
' wish to do so. This implies that the programmer actually wants to open
' a file as well so control is passed to the mmOpen routine
mmOpen sTheFile
End Property

Property Get Wait() As Boolean
' Routine to return the value of the object's wait property.
Wait = bWait
End Property

Property Let Wait(bWaitValue As Boolean)
' Routine to set the value of the object's wait property
bWait = bWaitValue
End Property

Property Get Length() As Single
' Routine to return the length of the currently opened multimedia file

' Declare a variable to hold the return value from the mciSendString
Dim nReturn As Long, nLength As Integer

' Declare a string to hold the returned length from the mci Status call
Dim sLength As String * 255

' If there is no file open then return 0
If sAlias = "" Then
Length = 0
Exit Property
End If

nReturn = mciSendString("Status " & sAlias & " length", sLength, 255, 0)
nLength = InStr(sLength, Chr$(0))
Length = Val(Left$(sLength, nLength - 1))
End Property

Property Let Position(ByVal nPosition As Single)
' Sets the Position property effectively by seeking
mmSeek nPosition
End Property

Property Get Position() As Single
' Returns the current position in the file

' Declare a variable to hold the return value from mciSendString
Dim nReturn As Integer, nLength As Integer

' Declare a variable to hold the position returned
' by the mci Status position command
Dim sPosition As String * 255

' If there is no file currently opened then exit the subroutine
If sAlias = "" Then Exit Property

' Get the position and return
nReturn = mciSendString("Status " & sAlias & " position", sPosition, 255, 0)
nLength = InStr(sPosition, Chr$(0))
Position = Val(Left$(sPosition, nLength - 1))

End Property

Property Get Status() As String
' Returns the playback/record status of the current file

' Declare a variable to hold the return value from mciSendString
Dim nReturn As Integer, nLength As Integer

' Declare a variable to hold the return string from mciSendString
Dim sStatus As String * 255

' If there is no file currently opened, then exit the subroutine
If sAlias = "" Then Exit Property

nReturn = mciSendString("Status " & sAlias & " mode", sStatus, 255, 0)

nLength = InStr(sStatus, Chr$(0))
Status = Left$(sStatus, nLength - 1)

End Property


Please help me. Thanks to all that help

Err.Raise && Loop Should Continue
Hi,

inside a for-each-loop I am writing

if condition = true then
continue with my code
else
Err.Raise 53, "A test error", "this is an error"
end if

The reason why I use err.raise is because I want to prevent that my CMS-system continues with the publishing process. You might think: Then do not use the publish-method in "else" but it is not as simple.
So I want that the rest of the code is not executed but the loop should go on

thanks for your ideas
Raggi

GoTo, Break, Continue...??
Are there break, goto, continue statements in VB? If so, which can we use if i had something like this:




Code:
For X = 0 to TotalRecords

For I = 1 to Num
If rs.recordset(1).value = EmployeeName Then tmpEmpNumber = I - 1

Next I

..... do this if above IF statement is true, if not, loop (Next X).

Next X

'C' Continue Equivalent In VB For Loops
hi!

I have a problem. I tried searching the 'C' continue equivalent for Vb unsuccessfully on msdn and google.Kindly help me.
May be i coud get my thing done by using a goto but i have not used goto much in my life as they says gotos are bad.

HELP
x11

<kindly note VB NU-B>

This Code How Can I Pause And Continue?
Code:
Private Sub Command1_Click()
Dim i

If Command1.Caption = "start" Then
Command1.Caption = "stop"

For i = 1 To 5000
Text1.SelText = i & vbCrLf

Next i

DoEvents

Else
Command1.Caption = "start"

Exit Sub
End If

msgbox "well done!", vbinformation, "successful prompt"

End Sub

private command2_click()

if command2.caption="Pause" then
command2.caption = "Continue"
I want to result pause here and appear in the text1, not loop until 5000, when i every time click it.

else
command2.caption="Pause"
continue loop result here!

end if

Whats The Continue Keyword?
I want a keyword that will go on to the next iteration of a loop. I tried the continue keyword. Sorry if this is a newb question.

For example:

Do While <cond>
If <cond> Then
continue
end if
... (other stuff)
Loop

That being equiv to:

Do While <cond>
If <cond> Then

Else
... (other stuff)
End If
Loop

VB.NET Line Continue Error.
I have this long SQL Statement and I am not sure on why it is giving me an error.

Error on this is:
Operator '&' is not defined for types 'String' and 'ADODB.Field'.


strSql = "SELECT " & _
"Companys.CompanyName," & _
"ListDepartments.DepartmentName," & _
"Users.UserFirstName," & _
"Users.UserLastName," & _
"AddressBook.ABCompanyLastName," & _
"ListPriority.PriorityName," & _
"ListStatus.StatusName," & _
"ListReturnToClientVia.ReturnToClientViaName," & _
"ListSendClientConfirmationVia.SendClientConfirmationViaName," & _
"MainLog.OrderId," & _
"ListJurisdiction.JurisdictionName," & _
"ListSubJurisdiction.SubJurisdictionName" & _
" FROM Companys,ListDepartments,Users,AddressBook,ListPriority,ListStatus,ListReturnToClientVia,ListSendCli entConfirmationVia,MainLog,ListJurisdiction,ListSubJurisdiction WHERE " & _
"MainLog.JurisdictionId*=ListJurisdiction.JurisdictionId" & _
" AND MainLog.SubJurisdictionId*=ListSubJurisdiction.SubJurisdictionId" & _
" AND Companys.CompanyId='" & rsMainLog("CompanyId") & "'" & _ <----Error Stops Here.
" AND ListDepartments.DepartmentId='" & rsMainLog("DepartmentId") & "'" & _...continues..............


"I FIXED MY ERROR... I TRIED DELETING BUT IT WILL NOT LET ME"

Wait On Callback To Continue
I've got a listbox where I WANT TO read a record from the listbox,
call the server, wait for callback from the server, then have listbox
read the next record, call the server, etc, until all listbox records have been processed.

HOW DO YOU GET THE LISTBOX TO WAIT ON THE CALLBACK FROM THE SERVER??

What Code In VB That Used Like 'break' And 'continue' In C?
Now I code some loop that must be use some code to 'continue' and 'break'. The 2 word I say is found on C but on VB I'm not found any word (I think 'break' may be replace with 'Exit For' in VB). What word that I can use in VB?

Text Box And ENTER Key As Continue
i got this code
VB Code:
If KeyAscii = 10 Then  tcpServer.SendData txtSendData  txtSendData.Text = Trim("")End If


Now when i press enter it works fine but it leaves a NEWLINE in it. Why? How do i get rid of this?

Pause/Continue Button
How can I make a button toggle the app between "Pause" and "Continue", so it waits until the user presses "Continue" after pressing "Pause"? I'm guessing a need a Do loop with a DoEvent statement, but I don't know what event to wait for to get out of it. Thanks!

Press Space To Continue
I'm working on a quiz app and i want to make it so if you press the space button, an image will appear (picture1.visible = true). How is this possible? PLease tell me . thx

ps sorry about my grammer

Continue To Next Form Button
Hi there,
Is it possible to set up a module which will move from one form to the next. I know it would be easy to have one like this:

Sub Continue()
Unload Form1
Load Form2
Form2.Show
End Sub

but lets say I have 3 forms. Can I use one module and simply call the module to unload the active form and load the next form in line? Maybe have the forms index 1 to 3 or something?

??
Sub Continue()
Unload i
i= i+1
load i
i.show
End sub

Control Structure In VB ( And, Continue, Do...while )
how to convert these control structure java code to VB?

1. and (&&) in "if"

if( i < 10 && b[i] < 5 ) // note, if i >=10, java does not check b[i]<5
{
...
}

2. dose vb have "continue"?

for( int i=0; i<10; i++)
{
if( a<10)
continue;

...
}


3.

do
{

} while( i<10 && a[i] <5 );

thanks! -Zhining

Continue The Program When Minimized
I wanna make a program that being minimized works over other programs, supose that by taching the vbkeynumpad1 the program send the letter "b" where ever the cursor is. My problem is that once I minimized the program the buttons don't work any more because the program is not active.

Continue With A Loop After Error
"a" is my field name in the table ....and is the primary key!!!
so its obvious tht every time i go through the for loop its gonna give me error except the first time
the problem here is when the first time the error is generated control goes to the error handler ....everythings fine.......but the second time wen this error is flashed it does go to the error handler instead brings up the vb error window putting me into the debug state


now what i want to do is after accepting say 50 records together from the user into a user type array ...insert them one by one into the database .....and not let the program halt even if the record(primary key) already exists....i.e continue with the next record

I am stuck and its urgent Please help

Private Sub Command1_Click()
DataEnv.rsCommand1.Open

On Error GoTo errh
For i = 0 To 10
    DataEnv.rsCommand1.AddNew
    DataEnv.rsCommand1("a") = 1
    DataEnv.rsCommand1.Update
    GoTo con
errh:
    MsgBox Err.Description
    Err.Clear
    DataEnv.rsCommand1.CancelUpdate
con:

Next i

End Sub

Copyright 2005-08 www.BigResource.com, All rights reserved