|
-
Jun 29th, 2012, 04:04 PM
#1
Thread Starter
Fanatic Member
Option Strict - Issues
I turned on Option Strict, but I have a few issues that I am not sure the best way to handle.
We leave the speech object as an object because some systems do not support speech and this is the only way we knew how to detect the issue. Any better ideas?
vb Code:
Public speech As Object = Nothing 'SpeechLib.SpVoice
I use VB .NET 2022. Currently developing StudyX educational software, PlazSales POS system and Yargis a space ship shooter game.
-
Jun 29th, 2012, 04:19 PM
#2
Re: Option Strict - Issues
leave options strict on as the default setting, then in the class/module/what ever where you're using the speech object, turn it off.
-tg
-
Jun 29th, 2012, 06:42 PM
#3
Thread Starter
Fanatic Member
Re: Option Strict - Issues
What do you recommend for this? I tried to change Object to Radio Button on the function header but it did not help.
error Code:
Error 9 Option Strict On disallows late binding. C:\Users\Jeff\Documents\JeffWorkSpace2\StudyX.NET\frmStudy.vb 1020 16 study
vb Code:
Private Sub _uotAnswer_0_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles rbOption1.KeyPress, rbOption2.KeyPress, rbOption3.KeyPress, rbOption4.KeyPress
If e.KeyChar = Chr(Keys.Return) Then 'Microsoft.VisualBasic.ChrW(Keys.Return)
If sender.Checked = True Then
btnNext_Click(sender, e)
End If
End If
End Sub
I use VB .NET 2022. Currently developing StudyX educational software, PlazSales POS system and Yargis a space ship shooter game.
-
Jun 29th, 2012, 08:19 PM
#4
Re: Option Strict - Issues
 Originally Posted by rex64
What do you recommend for this? I tried to change Object to Radio Button on the function header but it did not help.
error Code:
Error 9 Option Strict On disallows late binding. C:\Users\Jeff\Documents\JeffWorkSpace2\StudyX.NET\frmStudy.vb 1020 16 study
vb Code:
Private Sub _uotAnswer_0_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles rbOption1.KeyPress, rbOption2.KeyPress, rbOption3.KeyPress, rbOption4.KeyPress
If e.KeyChar = Chr(Keys.Return) Then 'Microsoft.VisualBasic.ChrW(Keys.Return)
If sender.Checked = True Then
btnNext_Click(sender, e)
End If
End If
End Sub
Here is how you should do this, knowing the event only handles RadioButton controls cast sender as a RadioButton, test for enter pressed and if so invoke PerformClick method for the Button.
Code:
Private Sub RadioButton1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles RadioButton1.KeyPress, RadioButton2.KeyPress
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then
If CType(sender, RadioButton).Checked Then
Button1.PerformClick()
End If
End If
End Sub
-
Jul 1st, 2012, 01:10 AM
#5
Re: Option Strict - Issues
The obvious solution is to use the Speech API built into the .NET Framework instead of the old Windows SAPI. .NET has provided its own Speech API since version 3.0. If you use that you know that every application that runs your app will support it because it must have the correct Framework installed.
-
Jul 2nd, 2012, 09:12 AM
#6
Thread Starter
Fanatic Member
Re: Option Strict - Issues
I am using .NET 2.0 because I want to maximize compatibility.
I use VB .NET 2022. Currently developing StudyX educational software, PlazSales POS system and Yargis a space ship shooter game.
-
Jul 2nd, 2012, 09:43 AM
#7
Re: Option Strict - Issues
Isn't that a little ironic given that you started this thread in the first place due to a compatibility issue? .NET 3.0 is supported on XP SP2 and Windows Server 2003 SP1. How much more compatibility do you want?
Last edited by jmcilhinney; Jul 2nd, 2012 at 08:56 PM.
-
Jul 2nd, 2012, 09:52 AM
#8
Thread Starter
Fanatic Member
Re: Option Strict - Issues
Good point, I think it is almost time to phase out 98 and SP1 . Our software is used in countries where people can not afford new computers, and we don't want to exclude them, but I think most people can do XP SP2 at least.
I use VB .NET 2022. Currently developing StudyX educational software, PlazSales POS system and Yargis a space ship shooter game.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|