Results 1 to 14 of 14

Thread: listbox again!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2001
    Location
    Germany, BW
    Posts
    157

    Unhappy listbox again!

    hy, why is this code wrong?

    vberror: "13"


    help

    Code:
    Option Explicit
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Const LB_FINDSTRING = &H18F
    Private Const LB_FINDSTRINGEXACT = &H1A2
    
    Private Sub Command1_Click()
    Dim startfrompoint As Long
    Dim firstFind As Long
    Dim DatumAdd1 As Currency
    
    startfrompoint = -1 'immer von ganz oben suchen
    DatumAdd1 = txtDateadd1.Text
    
    firstFind = SendMessage(ListReminderAll.hwnd, LB_FINDSTRINGEXACT, startfrompoint, ByVal "f")
    
    If firstFind <> -1 Then
    MsgBox "Eintrag gefunden. Index:" & firstFind
    Else
    ListReminderAll.AddItem DatumAdd1
    End If
    
    
    End Sub


    i dont get it!!

    thx Longbow
    Old enough to know better,
    but young enough to don't give a ****!

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    On which lines does it stop?

  3. #3
    If that's a type mismatch and it occurs on the line ListReminderAll.AddItem DatumAdd1, then try making it ListReminderAll.AddItem CStr(DatumAdd1).

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jul 2001
    Location
    Germany, BW
    Posts
    157

    Angry nope

    nope .. doesn't work !!


    vb blocked @


    DatumAdd1 = txtDateadd1.Text
    Old enough to know better,
    but young enough to don't give a ****!

  5. #5
    Well, like Chris said, which line is it on?

  6. #6
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Actually I think it's more likely to be this line
    VB Code:
    1. DatumAdd1 = txtDateadd1.Text
    since DatumAdd1 is a currency type.

  7. #7

    Re: nope

    Originally posted by [DBH]Longbow
    nope .. doesn't work !!


    vb blocked @


    DatumAdd1 = txtDateadd1.Text
    Then try DatumAdd1 = CDate(txtDateadd1.Text).

  8. #8
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923

    Re: Re: nope

    Originally posted by filburt1


    Then try DatumAdd1 = CDate(txtDateadd1.Text).
    DatumAdd1 is currency you numnut! Try CCur instead

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jul 2001
    Location
    Germany, BW
    Posts
    157

    ..

    no ..

    what could it be ??
    error on same line!!

    -> DatumAdd1 = CDate(txtDateadd1.Text)


    Code:
    vb suxx
    Old enough to know better,
    but young enough to don't give a ****!

  10. #10
    Fanatic Member Kings's Avatar
    Join Date
    Aug 2001
    Posts
    673
    VB Code:
    1. DatumAdd1 = CCur(txtDateadd1.Text)

    What does CCur mean?
    K i n g s

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Jul 2001
    Location
    Germany, BW
    Posts
    157

    Question

    sure .. doesnt work!!#


    hmm if i kick this ?? would be better!
    Old enough to know better,
    but young enough to don't give a ****!

  12. #12
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by Kings
    What does CCur mean?
    Should convert expression to currency...does it not?

  13. #13
    Originally posted by Kings
    What does CCur mean?
    http://msdn.microsoft.com/library/de.../vsfctCCur.asp

  14. #14
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    you're all gonna do a collective d]oh!!
    VB Code:
    1. firstFind = SendMessage(ListReminderAll.hwnd, _
    2. LB_FINDSTRINGEXACT, startfrompoint, [b]ByVal "f"[/b])
    Searching for "f" all the time.

    Ok, so the entry if it is a date should be string formatted using dd/mm/yy. If it is currency still convert to a string.

    eg
    VB Code:
    1. Private Sub Command1_Click()
    2.     Dim startfrompoint As Long
    3.     Dim firstFind As Long
    4.     Dim DatumAdd1 As String
    5.    
    6.     startfrompoint = -1 'immer von ganz oben suchen
    7.     [b]DatumAdd1 = Format$(txtDateadd1.Text, "dd/mm/yy") 'OR "0.00" IF Currency[/b]
    8.    
    9.     firstFind = SendMessage(ListReminderAll.hwnd, LB_FINDSTRINGEXACT, startfrompoint, ByVal [b]Datumadd1[/b])
    10.     If firstFind <> -1 Then
    11.         MsgBox "Eintrag gefunden. Index:" & firstFind
    12.     Else
    13.         ListReminderAll.AddItem DatumAdd1
    14.     End If
    15. End Sub
    Regards
    Stuart
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

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