Click here to Skip to main content
15,905,414 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Sending SMS in VB6 Pin
Dave Kreskowiak13-May-05 0:51
mveDave Kreskowiak13-May-05 0:51 
GeneralRe: Sending SMS in VB6 Pin
jonathan1512-May-05 22:54
jonathan1512-May-05 22:54 
GeneralVB.Net Module coding Pin
directred12-May-05 8:04
directred12-May-05 8:04 
GeneralRe: VB.Net Module coding Pin
Dave Kreskowiak12-May-05 8:38
mveDave Kreskowiak12-May-05 8:38 
GeneralUrgent - Drag and Drop Help Needed Pin
BritishEmpire12-May-05 6:30
BritishEmpire12-May-05 6:30 
GeneralRe: Urgent - Drag and Drop Help Needed Pin
Scott Page24-May-05 3:42
professionalScott Page24-May-05 3:42 
GeneralDetect Unicode/non-ascii characters from a file stream Pin
ImranIBM12-May-05 6:28
ImranIBM12-May-05 6:28 
GeneralRe: Detect Unicode/non-ascii characters from a file stream Pin
Scott Page25-May-05 14:42
professionalScott Page25-May-05 14:42 
One way is to simply check if the value of each byte is greater than 127 for Standard Ascii characters (if that is all you want to be sure of). If you need to check for Standard and Extended Ascii characters then check the byte value and make sure it is not greater than 255.

Also remember, if your seeing characters it's ASCII or Unicode of some kind.

As far as the Unicode characters, you will need to specify a function similar to this one for getting the values based on the Unicode encoding you choose.

Here is a function that will tell give you a return value for Standard, Extended and non-ASCII values.

VB
<code lang=vbnet>
Public Shared Function GetASCIIRating(ByVal Value As String) As Integer
'Setup a Byte variable and a Try...Catch statement.
'When the CByte function casts Value to a Byte, an exception will be thrown if it is larger than 255.
'A Byte has a max value of 255 because, 255 in binary is 1111, which is one byte.
    Dim TestedValue As Byte
    Try
        TestedValue = CByte(Value)
    Catch
        'Return -1 for all non-Standard and non-Extended ASCII byte values.
        Return -1
    End Try
    'Check if Value is Standard ASCII Character
    If (TestedValue >= 0 And TestedValue <=127) Then
        Return 0
    'Check if Value is Extended ASCII Character
    ElseIf (TestedValue > 127 And TestedValue <=255) Then
        Return 1
    'If all else fails, return -1
    Else
        Return -1
    End If
End Function

'Test our function
MsgBox(GetASCIIRating(56))
MsgBox(GetASCIIRating(132))
MsgBox(GetASCIIRating(256))
</code>


Hope this helps more than hurts,

Scott
GeneralVB.Net error - An unhandled exception of type occurred Pin
directred12-May-05 5:46
directred12-May-05 5:46 
GeneralRe: VB.Net error - An unhandled exception of type occurred Pin
Dave Kreskowiak12-May-05 7:26
mveDave Kreskowiak12-May-05 7:26 
GeneralRe: VB.Net error - An unhandled exception of type occurred Pin
directred12-May-05 8:01
directred12-May-05 8:01 
GeneralRe: VB.Net error - An unhandled exception of type occurred Pin
Dave Kreskowiak12-May-05 8:33
mveDave Kreskowiak12-May-05 8:33 
GeneralAuto fill combo box from the dataset in a Web Application Pin
Treacherous_112-May-05 5:23
Treacherous_112-May-05 5:23 
GeneralRe: Auto fill combo box from the dataset in a Web Application Pin
Treacherous_112-May-05 6:13
Treacherous_112-May-05 6:13 
GeneralZip/Unzip in VB 6.0 Pin
Navees Ahmed12-May-05 3:32
Navees Ahmed12-May-05 3:32 
GeneralRe: Zip/Unzip in VB 6.0 Pin
Dave Kreskowiak12-May-05 7:21
mveDave Kreskowiak12-May-05 7:21 
GeneralRe: Zip/Unzip in VB 6.0 Pin
Navees Ahmed12-May-05 18:47
Navees Ahmed12-May-05 18:47 
Generallistbox Pin
Anonymous12-May-05 0:55
Anonymous12-May-05 0:55 
GeneralRe: listbox Pin
mikelon12-May-05 6:15
mikelon12-May-05 6:15 
GeneralRe: listbox Pin
Anonymous12-May-05 12:39
Anonymous12-May-05 12:39 
GeneralRe: listbox Pin
rswipe17-May-05 1:39
rswipe17-May-05 1:39 
GeneralMenu enabling problem Pin
K. Srinivas12-May-05 0:32
K. Srinivas12-May-05 0:32 
Generalproblem in vb.net Pin
Manik Nath11-May-05 23:21
Manik Nath11-May-05 23:21 
GeneralRe: problem in vb.net Pin
Treacherous_112-May-05 6:12
Treacherous_112-May-05 6:12 
GeneralRe: problem in vb.net Pin
Manik Nath12-May-05 18:19
Manik Nath12-May-05 18:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.