Results 1 to 3 of 3

Thread: Little Help?

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Location
    Sydney, Australia
    Posts
    2

    Little Help?

    Im making a small program to determine to sizes of video files. I've previously made two forms to calculate the sizes of compressed and uncompressed video files; however, I'm also trying to make another form that allows the user to enter a particular storage space in which the program then determines the best recommended video/audio bitrate (kb/sec) for the file.

    Problem is I get a type mismatch error at 'VBitrate = txtVBR', the properties of that text box seem fine so I assume there is a problem in the code somewhere?

    ------------------------------------------------------
    Private Sub CmdCRB_Click()

    Dim KByte As Single
    Dim MByte As Single
    Dim GByte As Single
    Dim Hours As Single
    Dim Minutes As Single
    Dim Seconds As Single

    Dim FileLength As Single
    Dim VBitrate As Single
    Dim ABitrate As Single
    Dim FVBitrate As Single

    KByte = txtKB
    MByte = txtMB
    GByte = txtGB
    Hours = txtHours
    Minutes = txtMinutes
    Seconds = txtSeconds
    VBitrate = txtVBR
    ABitrate = txtABR

    FileLength = (Hours * 3600) + (Minutes * 60) + Seconds
    VBitrate = FileLength / ((KByte * 8) + (MByte * 8192) + (GByte * 8388608))
    ABitrate = FileLength / 224
    FVBitrate = VBitrate - ABitrate

    txtVBR = Str$(FVBitrate) & " Kb/sec "
    txtABR = Str$(ABitrate) & " Kb/sec"

    End Sub
    ------------------------------------------------------

    Also the program will also crash if I type a letter in a text box or leave it blank?

    Im pretty sure it's something simple although I'm quite new at this and can't see it.

    Any help would be much appreciated

  2. #2
    Registered User
    Join Date
    Apr 1999
    Location
    Brazil
    Posts
    144

    Conversion

    The problem is that you need convert text into Single data type. Test before using IsNumeric() to avoid crashes;

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Location
    Sydney, Australia
    Posts
    2
    I used the Val function, and it seems to work fine now.

    Thanks for your help anway

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width