SCBWV 71 Junior Poster

You misspelled bordercolor

line1.bodercolor = vbRed
line1.bodercolor = vbBlack

line1.bordercolor = vbRed
line1.bordercolor = vbBlack

SCBWV 71 Junior Poster

First of all, you declared MTime as Byte when you're using it as an integer. Secondly, why not just use the Timer event instead of MTime?

Private Sub Form_Load()
MMControl1.Command = "Open"
MMControl1.Command = "Play"
End Sub

Private Sub Timer1_Timer()
MMControl1.Command = "Stop"
MMControl1.Command = "Close"
MMControl1.Command = "Open"
MMControl1.Command = "Play"
End Sub

SCBWV 71 Junior Poster

Been my experience that USB won't use an AutoRun.Inf file like a CD will.

SCBWV 71 Junior Poster

May I suggest a slight coding change for efficiency and readability?

Instead of :
Private Sub File1_Click()
If Combo1.ListIndex = 0 Then
File1.Pattern = ("*.wav")
ElseIf Combo1.ListIndex = 1 Then
File1.Pattern = ("*.mid")
ElseIf Combo1.ListIndex = 2 Then
File1.Pattern = ("*.avi;*.mpg")
Else
File1.Pattern = ("*.*")
End If

Use:
Private Sub File1_Click()
Select Case Combo1.ListIndex
Case 0
File1.Pattern = "*.wav"
Case 1
File1.Pattern = "*.mid"
Case 2
File1.Pattern = "*.avi;*.mpg"
Case Else
File1.Pattern = "*.*"
End Select

SCBWV 71 Junior Poster

namefile = App.Path & "\Accounts\" & Text1.Text & ".txt"

if Dir$(namefile) <> "" then
msgbox ="Username already exists"
else
Open namefile For Output As #1
...
...
end if

To avoid any potential conflicts in file numbers, you should use the FreeFile function:

fileNumber = FreeFile()
Open namefile For Output As #fileNumber

SCBWV 71 Junior Poster

Random numbers, where High is the upper limit and low is the lower limit of the range desired:

Randomize Timer
Rand = Int((High - Low + 1) * Rnd) + Low

SCBWV 71 Junior Poster

If you want to trap the Tab key in the KeyPress event, you have to disable to TabStop property in all other controls on the form, but you will have to handle moving the control focus yourself. Once the TabStop property is set to false, the Tab key will be trapped in the KeyPress event. Be sure to set the KeyPreview property on the form.

On Error Resume Next
For Each Control In Controls
Control.TabStop = False
Next

SCBWV 71 Junior Poster

New line? Random access files do not have lines, they have records. In this case, each record is the length of the feedback. So every Len(feedback) is a new record. If you want one record per line, then you want a text file. However, you can't randomly read a text file, so there's no way to read the 15th record without reading 1-14 first. Do you want random access or lines?

SCBWV 71 Junior Poster

I don't know that. You might see if you can find the article.

SCBWV 71 Junior Poster

That link should provide you with the best advice, but why not use the Visual Studio Installer?

SCBWV 71 Junior Poster

Unofrtunately, I believe so. I suppose you could dynamically add menu items in a common subroutine. Each form would have to handle the click events, although here too, you could call a common subroutine to do the actual work. It might be more trouble then its work, tracking which form is doing what. But, having common routines DOES help keep all menus in sync is you have menus with disabled or checked items.

SCBWV 71 Junior Poster

If I remember an old Charles Petzold article correctly, that specific progress bar was made with a gradient, and the motion was created by manipulating the color palette.

SCBWV 71 Junior Poster

Maybe look at the Mod function... interesting, 1462 Mod 365 = 2. Wonder when DateDiff starts?

SCBWV 71 Junior Poster

Sounds to me like you want to sunchronize the toolbar on all the mdi forms. Try looping through the forms collection:

If you can identify each mdi form by name then you can use:

For Each frm In Forms
If frm.Name = "mdiform" Then
frm.Toolbar1.Buttons(5).Value = tbrPressed
End If
Next

If you can't specifically identify the mdi forms, use:

On Error Resume Next
For Each frm In Forms
frm.Toolbar1.Buttons(5).Value = tbrPressed
Next

I would also use Keys for your buttons, so if you change button positions in the toolbar, you won't have to redo a lot of code. You can assign each button a key. Then instead of referencing them by number you can reference them by name.

For example:
Toolbar1.Buttons(5) or Toolbar1.Buttons("Play")

SCBWV 71 Junior Poster
SCBWV 71 Junior Poster

Single quotes are need with text, not numbers.

SCBWV 71 Junior Poster

Its hard for me to follow which forms are which in your example. However, you can use
Use fmticket.Text1.Text = fmpay1.Text1.Text to have one form's text box use the value of the other.

SCBWV 71 Junior Poster

Random Access files use records, much like a database, but you define the record in a user defined type. You should create a user defined type much like you create the fields for a record in a database. be that as it may, you're not incrementing the recordNum variable properl and your If/Then is inccorect. You should increment it inside each loop. For instance:
For Index = 0 To 4
If optLaboratory(Index).Value = True Then
feedback.Laboratory(Index) = 1
Else: feedback.Laboratory(Index) = 0
recordNum = recordNum + 1 'increment for each value
End If ' should be here
Put #1, recordNum, feedback
'Exit For 'this shouldn't even be here
End If 'woing place
Next Index

SCBWV 71 Junior Poster

Just a guess... could it be the field is numeric, where your selection criteria (lblLECNUM ) is text (Caption property)?

SCBWV 71 Junior Poster

You have Exit For outside every For-Next loop in cmdSubmit_click. Exit For is used to conditionally end the For-Next loop early... such as "If condition = true then Exit For."

SCBWV 71 Junior Poster

Use a autonumber field as a key. Then randomly generate a number between 1 and the total number of questions to retrieve the questions based on the key.

SCBWV 71 Junior Poster

Copy protection usually brings its own set up problems, which I don't care to support in my commercial applications. I imagine that could be a nightmare.

I use a key code, that I build into the installation routine and the program. The code is based on the user and company name, which I know beforehand from the sale. The user and company name are displayed in the splash box and also printed on the program reports. I've found having their name in large type in the header of the reports to be enough to discourage copying.

Doubt this is the answer you wanted, but it may give you some ideas.

SCBWV 71 Junior Poster

Why convert to ADO? I successfully sell a DAO database that runs on everything from 98 to Vista. I'm not sure about 95, but feel confident it would. I've used Access 98, 2000, and 2002-2003 formats. The Visual Studio Installer, or the Package and Deployment Wizard, should identify and include all the files you need.

SCBWV 71 Junior Poster

You don't have to lock the text box, just set KeyAscii to 0. Also, you need to handle the backspace key to allow users to fix errors:

Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 To 57, 8
'Let these key codes pass through
Case Else
'All others get trapped
KeyAscii = 0
End Select
End Sub

Jx_Man commented: Nice Recovery +1
SCBWV 71 Junior Poster

Check for both...

If InStr(Email$, "@") > 0 AND InStr(Email$, ".") > 0 Then
'Valid Email Format
else 'not valid
end if

pranavdv commented: helpful person upto the last query +1
SCBWV 71 Junior Poster

I believe the last VB version to use binary (tokenized) source files was 3.

SCBWV 71 Junior Poster

Private Function GetColor(DefaultColor)
On Local Error GoTo GetColorError
CommonDialog1.CancelError = True
CommonDialog1.Flags = cdlCCRGBInit
CommonDialog1.Color = DefaultColor
CommonDialog1.ShowColor
GetColor = CommonDialog1.Color
Exit Function
GetColorError:
'User clicked the Cancel button
GetColor = DefaultColor
End Function

SCBWV 71 Junior Poster

Try:

("select * from parlordb where custname=" & searchname)

It appears you are using DAO as opposed to ODBC. If so, why not use:

myrs1.FindFirst txtsearchname.Text

SCBWV 71 Junior Poster

Well, you'll have to check for thsoe as well. But what's to prevent someone from entering "no@way.com" as a bogus address? There's really no way to validate legitimate addresses. I would check for the presence of an @ sign and a period in the input, and assume they typed a legitimate address.

SCBWV 71 Junior Poster

Anyone experience problems with a disappearing control focus rectangle when using an XP style manifest?

Some check boxes and option boxes no longer show the focus rectangle when the control gets focus using the kayboard and the tab key. Some do, some don't. Rather strange. I've tried putting them in picture boxes, but that didn't help either.

When the manifest file is removed, the rectangle returns, so it has to be related.

SCBWV 71 Junior Poster

If I remember correctly, an earlier version of Visual Basic used to save files in binary format as the default (which loaded faster), with the option of saving them in text format. You'll have to load them in an older version and resave them in text format

SCBWV 71 Junior Poster

Why not use InStr?

If InStr(Email$, "@") > 0 Then 'Valid Email Format

If UCase$(Left$(Website$, 4))="WWW." then 'valid web format

If UCase$(Left$(Website$, 11))="HTTP://WWW." then 'valid web format

SCBWV 71 Junior Poster

Why not use FileCopy?

FileCopy(Source As String, Destination As String)

SCBWV 71 Junior Poster

Why not just copy the file PTSTEST over PTSPROD?

SCBWV 71 Junior Poster

You're very welcome.

SCBWV 71 Junior Poster

Your code has many issues to be fixed... such as form placement, handling the backspace key, etc.

Anyway, I did what I could quickly. Try the attached.

You have to right click on the link and use "Save Target As" otherwise you will get a corrupt compressed file. Not sure why. Seems to be something with DaniWeb.

SCBWV 71 Junior Poster

Send me your email and I'll send you one I wrote.

SCBWV 71 Junior Poster
SCBWV 71 Junior Poster

File$ = Dir("*.DAT")
Do While File$ > ""
'Open and process file here
'Close File
File$ = Dir
Loop

SCBWV 71 Junior Poster

Since it seems the Excel data is populating a text box control, why not use the Change event for the text box to trigger your code?

Qpido commented: Thanks +1
SCBWV 71 Junior Poster

I don't use Global. I put all my public declarations in a Module:

Public ErrorStatus as Long

SCBWV 71 Junior Poster

Are you using VB.Net? Cos I'm using VB6 SP6 and I don't see a Protection option.

SCBWV 71 Junior Poster

App.Path is Read Only and is set to the path of the executable file. You shouldn't define this anyway, as a user may chose a different path when installing the program. You can use like App.Path$ & "\Data\MyFile.MDB" and your program will the data directory no matter when the user installed your program.

SCBWV 71 Junior Poster

Your syntax is wrong for the control array. frmsummary.lblfname(0) = frmWage.lblfirstname.Caption should be frmsummary.lblfname(0).caption = frmWage.lblfirstname.Caption

I don't think you're understanding the suggestions. If the labels are controls, you don't need to Dim strings.

In frmwage and your other form, text boxes should gather the user input. Then in the Form_Load event of the frmsummary form, you can use something like this:

Private Sub Form_Load()
for i = 0 to 9
frmsummary.lblfname(i).Caption = frmWage.lblfirstname(i).Caption
'use frmsummary.lblfname(i).Caption = frmWage.lblfirstname(i).Text for Text Boxes
next
end sub

Can you attach a zip file of your forms?

SCBWV 71 Junior Poster

The easiest way to make a control array is to create the first control, then copy and paste the others. The first time you paste the control, Visual Basic will ask you if you want to create a control array. Say yes. From then on, every copy you paste will be in the control array.

A couple points:

Control arrays require an index. For instead of lblfname.caption, it becomes lblfname(index).caption, where index is a number. The nice thing about control arrays is that they all share the same event procedures... click, change, etc. The Index argument of the procedure will tell you which control fired the event.

Control arrays default to an index of 0, although you can change it to 1. Therefore, the first control in the array will be 0; lblfname(0). So for your 10 labels it ranges from lblfname(0) to lblfname(9).

SCBWV 71 Junior Poster

In the Form_Load event of the summary form, load the captions from the other two forms.

It's probably NOT how I would populate data from one form to another, but if you insist on doing so with labels, I suggest making the labels a control array so you can populate them in a for / next loop:

for i - 0 to 9
frmsummary.label(i). caption = form1.label(i).caption
next

SCBWV 71 Junior Poster

Well, there's lots of ways to do this. For example, you could have labels for all 10 on the summary for and populate each individually from the first two forms. You could have the summary form contain a list control with columns that is populated from the other forms.

SCBWV 71 Junior Poster

You can use frmsummary.lblfname0.Caption = frmWage.lblfirstname.Caption or you can put the captions / text in public variables which are accessible to any form.

SCBWV 71 Junior Poster

The CoolBar is part of Microsoft Windows Common Controls-3. Using the Projects menu, select Components to bring up the Components dialog box. On the Controls Tab, check "Microsoft Windows Common Controls-3"

SCBWV 71 Junior Poster

The toolbar should be in a CoolBar. In the CoolBar Property Pages, on the Band tab, there's a settign for New Row. Add more then one Band and set the second Band to NewRow.