Help needed with changing captions during run time 
Author Message
 Help needed with changing captions during run time

Hi

Below is my code for a screen that shows the results for the test taken in
my program. The problem is that whenever the screen is supposed to display
the results, no change takes place on the screen, ie. the label used to
display the percentage obtained DOESN'T change it's caption... can't even
get the form's caption to change. It's only this form that have this
problem.

I haven't included the declarations section, etc. etc.etc. in the code
below...

Private Sub Form_Load()
ChDir ("c:\work\caamex\")
Set DatabaseFile = OpenDatabase("CPL - Questions.MDB")
Set RS = DatabaseFile.OpenRecordset("Questions", dbOpenDynaset)

Percentage = 0
TotalMarks = 0
MarksObtained = 0
RS.MoveFirst

Do Until RS.EOF
TotalMarks = TotalMarks + CInt(RS!txMarks)
If RS!MarksGiven = "None" Then
Exit Sub
Else
MarksObtained = MarksObtained + CInt(RS!MarksGiven)
End If
RS.MoveNext
Loop

Percentage = MarksObtained / TotalMarks * 100

frmScreenResults.lblPercentage.Caption = Percentage

End Sub

===========

I don't have a clue as to what and try to do next... previously it worked
without any problem, and I don't know what I might've did to cause it to
behave like this.

Any ideas/suggestions are welcomed!

Thanx!!!!!

Tinus



Wed, 18 Jun 1902 08:00:00 GMT  
 Help needed with changing captions during run time
What happens if you Refresh the Label after setting its Caption?

     frmScreenResults.lblPercentage.Caption = Percentage
     frmScreenResults.lblPercentage.Refresh

Rick


Quote:
> Hi

> Below is my code for a screen that shows the results for the test taken in
> my program. The problem is that whenever the screen is supposed to display
> the results, no change takes place on the screen, ie. the label used to
> display the percentage obtained DOESN'T change it's caption... can't even
> get the form's caption to change. It's only this form that have this
> problem.

> I haven't included the declarations section, etc. etc.etc. in the code
> below...

> Private Sub Form_Load()
> ChDir ("c:\work\caamex\")
> Set DatabaseFile = OpenDatabase("CPL - Questions.MDB")
> Set RS = DatabaseFile.OpenRecordset("Questions", dbOpenDynaset)

> Percentage = 0
> TotalMarks = 0
> MarksObtained = 0
> RS.MoveFirst

> Do Until RS.EOF
> TotalMarks = TotalMarks + CInt(RS!txMarks)
> If RS!MarksGiven = "None" Then
> Exit Sub
> Else
> MarksObtained = MarksObtained + CInt(RS!MarksGiven)
> End If
> RS.MoveNext
> Loop

> Percentage = MarksObtained / TotalMarks * 100

> frmScreenResults.lblPercentage.Caption = Percentage

> End Sub

> ===========

> I don't have a clue as to what and try to do next... previously it worked
> without any problem, and I don't know what I might've did to cause it to
> behave like this.

> Any ideas/suggestions are welcomed!

> Thanx!!!!!

> Tinus



Wed, 18 Jun 1902 08:00:00 GMT  
 Help needed with changing captions during run time
You haven't displayed the current form Modally have you?  Also, have you
tried compiling it to an executable and seeing what happens then?

--
Howard Henry Schlunder
AutoSigAmp Plug-In by Howard:
 Winamp is currently playing:
 Goo Goo Dolls - So Long


Quote:
> Hi

> Below is my code for a screen that shows the results for the test taken in
> my program. The problem is that whenever the screen is supposed to display
> the results, no change takes place on the screen, ie. the label used to
> display the percentage obtained DOESN'T change it's caption... can't even
> get the form's caption to change. It's only this form that have this
> problem.

> I haven't included the declarations section, etc. etc.etc. in the code
> below...

> Private Sub Form_Load()
> ChDir ("c:\work\caamex\")
> Set DatabaseFile = OpenDatabase("CPL - Questions.MDB")
> Set RS = DatabaseFile.OpenRecordset("Questions", dbOpenDynaset)

> Percentage = 0
> TotalMarks = 0
> MarksObtained = 0
> RS.MoveFirst

> Do Until RS.EOF
> TotalMarks = TotalMarks + CInt(RS!txMarks)
> If RS!MarksGiven = "None" Then
> Exit Sub
> Else
> MarksObtained = MarksObtained + CInt(RS!MarksGiven)
> End If
> RS.MoveNext
> Loop

> Percentage = MarksObtained / TotalMarks * 100

> frmScreenResults.lblPercentage.Caption = Percentage

> End Sub

> ===========

> I don't have a clue as to what and try to do next... previously it worked
> without any problem, and I don't know what I might've did to cause it to
> behave like this.

> Any ideas/suggestions are welcomed!

> Thanx!!!!!

> Tinus



Wed, 18 Jun 1902 08:00:00 GMT  
 Help needed with changing captions during run time
Nope,

Doesn't work --- I deleted the form and created a new one (luckily it was a
VERY SIMPLE form) and my problem was solved... so somewhere, something
wasn't setup correctly.


Quote:
> What happens if you Refresh the Label after setting its Caption?

>      frmScreenResults.lblPercentage.Caption = Percentage
>      frmScreenResults.lblPercentage.Refresh

> Rick



> > Hi

> > Below is my code for a screen that shows the results for the test taken
in
> > my program. The problem is that whenever the screen is supposed to
display
> > the results, no change takes place on the screen, ie. the label used to
> > display the percentage obtained DOESN'T change it's caption... can't
even
> > get the form's caption to change. It's only this form that have this
> > problem.

> > I haven't included the declarations section, etc. etc.etc. in the code
> > below...

> > Private Sub Form_Load()
> > ChDir ("c:\work\caamex\")
> > Set DatabaseFile = OpenDatabase("CPL - Questions.MDB")
> > Set RS = DatabaseFile.OpenRecordset("Questions", dbOpenDynaset)

> > Percentage = 0
> > TotalMarks = 0
> > MarksObtained = 0
> > RS.MoveFirst

> > Do Until RS.EOF
> > TotalMarks = TotalMarks + CInt(RS!txMarks)
> > If RS!MarksGiven = "None" Then
> > Exit Sub
> > Else
> > MarksObtained = MarksObtained + CInt(RS!MarksGiven)
> > End If
> > RS.MoveNext
> > Loop

> > Percentage = MarksObtained / TotalMarks * 100

> > frmScreenResults.lblPercentage.Caption = Percentage

> > End Sub

> > ===========

> > I don't have a clue as to what and try to do next... previously it
worked
> > without any problem, and I don't know what I might've did to cause it to
> > behave like this.

> > Any ideas/suggestions are welcomed!

> > Thanx!!!!!

> > Tinus



Wed, 18 Jun 1902 08:00:00 GMT  
 Help needed with changing captions during run time
That's not the first time I've heard that throwing the offending Form away
and recreating it solved the problem. Makes you wonder if VB is as solid
underfoot as it should (needs to) be.

Rick


Quote:
> Nope,

> Doesn't work --- I deleted the form and created a new one (luckily it was
a
> VERY SIMPLE form) and my problem was solved... so somewhere, something
> wasn't setup correctly.



> > What happens if you Refresh the Label after setting its Caption?

> >      frmScreenResults.lblPercentage.Caption = Percentage
> >      frmScreenResults.lblPercentage.Refresh

> > Rick



> > > Hi

> > > Below is my code for a screen that shows the results for the test
taken
> in
> > > my program. The problem is that whenever the screen is supposed to
> display
> > > the results, no change takes place on the screen, ie. the label used
to
> > > display the percentage obtained DOESN'T change it's caption... can't
> even
> > > get the form's caption to change. It's only this form that have this
> > > problem.

> > > I haven't included the declarations section, etc. etc.etc. in the code
> > > below...

> > > Private Sub Form_Load()
> > > ChDir ("c:\work\caamex\")
> > > Set DatabaseFile = OpenDatabase("CPL - Questions.MDB")
> > > Set RS = DatabaseFile.OpenRecordset("Questions", dbOpenDynaset)

> > > Percentage = 0
> > > TotalMarks = 0
> > > MarksObtained = 0
> > > RS.MoveFirst

> > > Do Until RS.EOF
> > > TotalMarks = TotalMarks + CInt(RS!txMarks)
> > > If RS!MarksGiven = "None" Then
> > > Exit Sub
> > > Else
> > > MarksObtained = MarksObtained + CInt(RS!MarksGiven)
> > > End If
> > > RS.MoveNext
> > > Loop

> > > Percentage = MarksObtained / TotalMarks * 100

> > > frmScreenResults.lblPercentage.Caption = Percentage

> > > End Sub

> > > ===========

> > > I don't have a clue as to what and try to do next... previously it
> worked
> > > without any problem, and I don't know what I might've did to cause it
to
> > > behave like this.

> > > Any ideas/suggestions are welcomed!

> > > Thanx!!!!!

> > > Tinus



Wed, 18 Jun 1902 08:00:00 GMT  
 Help needed with changing captions during run time
Hey

Anything about the subject at MS's site???  Or another similar site about
possible "glitches" within VB???


Quote:
> That's not the first time I've heard that throwing the offending Form away
> and recreating it solved the problem. Makes you wonder if VB is as solid
> underfoot as it should (needs to) be.

> Rick



> > Nope,

> > Doesn't work --- I deleted the form and created a new one (luckily it
was
> a
> > VERY SIMPLE form) and my problem was solved... so somewhere, something
> > wasn't setup correctly.



> > > What happens if you Refresh the Label after setting its Caption?

> > >      frmScreenResults.lblPercentage.Caption = Percentage
> > >      frmScreenResults.lblPercentage.Refresh

> > > Rick



> > > > Hi

> > > > Below is my code for a screen that shows the results for the test
> taken
> > in
> > > > my program. The problem is that whenever the screen is supposed to
> > display
> > > > the results, no change takes place on the screen, ie. the label used
> to
> > > > display the percentage obtained DOESN'T change it's caption... can't
> > even
> > > > get the form's caption to change. It's only this form that have this
> > > > problem.

> > > > I haven't included the declarations section, etc. etc.etc. in the
code
> > > > below...

> > > > Private Sub Form_Load()
> > > > ChDir ("c:\work\caamex\")
> > > > Set DatabaseFile = OpenDatabase("CPL - Questions.MDB")
> > > > Set RS = DatabaseFile.OpenRecordset("Questions", dbOpenDynaset)

> > > > Percentage = 0
> > > > TotalMarks = 0
> > > > MarksObtained = 0
> > > > RS.MoveFirst

> > > > Do Until RS.EOF
> > > > TotalMarks = TotalMarks + CInt(RS!txMarks)
> > > > If RS!MarksGiven = "None" Then
> > > > Exit Sub
> > > > Else
> > > > MarksObtained = MarksObtained + CInt(RS!MarksGiven)
> > > > End If
> > > > RS.MoveNext
> > > > Loop

> > > > Percentage = MarksObtained / TotalMarks * 100

> > > > frmScreenResults.lblPercentage.Caption = Percentage

> > > > End Sub

> > > > ===========

> > > > I don't have a clue as to what and try to do next... previously it
> > worked
> > > > without any problem, and I don't know what I might've did to cause
it
> to
> > > > behave like this.

> > > > Any ideas/suggestions are welcomed!

> > > > Thanx!!!!!

> > > > Tinus



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Changing the caption property on a label at run time

2. Changing the caption property on a label at run time

3. Changing cmdButton.caption property at run time

4. Changing the caption property on a label at run time

5. How to change a Label caption on run time

6. Changing Locked Property in Access 2.0 During Run Time

7. Changing form's icon during run-time

8. Changing tabstrip during run-time

9. Change the filename of a graphicfile in a report during run-time

10. changing label on datareport during run-time

11. Changing tabstrip during run-time

12. Change the filename of a graphicfile in a report during run-time

 

 
Powered by phpBB® Forum Software