Click here to Skip to main content
15,923,015 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: text to speech in .net Pin
Member 8573776-Jun-04 3:53
Member 8573776-Jun-04 3:53 
GeneralRe: text to speech in .net Pin
Dave Kreskowiak6-Jun-04 9:41
mveDave Kreskowiak6-Jun-04 9:41 
GeneralRe: text to speech in .net Pin
Member 8573776-Jun-04 10:10
Member 8573776-Jun-04 10:10 
GeneralRe: text to speech in .net Pin
emari9-Jun-04 20:17
emari9-Jun-04 20:17 
Generallvm_insertitem Pin
klaus_745-Jun-04 2:34
klaus_745-Jun-04 2:34 
GeneralRe: lvm_insertitem Pin
Dave Kreskowiak5-Jun-04 6:07
mveDave Kreskowiak5-Jun-04 6:07 
GeneralRe: lvm_insertitem Pin
klaus_745-Jun-04 21:03
klaus_745-Jun-04 21:03 
GeneralRe: lvm_insertitem Pin
Dave Kreskowiak6-Jun-04 9:06
mveDave Kreskowiak6-Jun-04 9:06 
For one, your using VB.NET and passing Long's for your parameters. Use Integers instead. VB6 passed Long's because they are 32-bit integer's. In VB.NET, they are 64-bit. Next, declare your structure with a Sequential Layout. This will make sure that all of your structure members appear in memory in the order that you specified them. Lastly, don't do this on a Form_Load event. It is not guaranteed that your ListView will even have a handle until after Form_Load is complete. Test it in a button click event.
Public Declare Auto Function SendMessage Lib "user32" Alias "SendMessageA" ( _
                    ByVal hwnd As IntPtr, ByVal wMsg As Integer, _
                    ByVal wParam As Integer, ByRef lParam As LVITEM) As Integer
 
<StructLayout(LayoutKind.Sequential, CharSet := CharSet.Ansi)> _
Public Structure LVITEM
    Public mask As Integer
    Public iItem As Integer
    Public iSubItem As Integer
    Public State As Integer
    Public stateMask As Integer
    Public pszText As String
    Public cchTextMax As Integer
    Public iImage As Integer
    Public lParam As Integer
    Public iIndent As Integer
    Public iGroupId As Integer
    Public cColumns As Integer
    Public puColumns As Integer
End Structure
 
Public Const LVIF_TEXT = &H1
Public Const LVIF_IMAGE = &H2
Public Const LVIF_PARAM = &H4
Public Const LVIF_STATE = &H8
Public Const LVIF_INDENT = &H10
Public Const LVIF_GROUPID = &H100
Public Const LVIF_COLUMNS = &H200
 
Public Const LVM_FIRST = &H1000&
 
Public Const LVM_INSERTITEMA = (LVM_FIRST + 7)
Public Const LVM_INSERTITEM = LVM_INSERTITEMA
 
Public Const LVM_GETITEMCOUNT = (LVM_FIRST + 4)
 
Private Sub fAddItem(ByVal sText As String, Optional ByVal lIndex As Integer = 1, _
            Optional ByVal iIcon As Integer = -1, Optional ByVal iIndent As Integer = 0, _
            Optional ByVal lItemData As Integer = 0)
    Dim tLV As LVITEM
    Dim lR As Integer
 
    tLV.pszText = sText & vbNullChar
    tLV.cchTextMax = Len(sText) + 1
    tLV.iImage = iIcon
    tLV.iIndent = iIndent
    tLV.lParam = lItemData
    tLV.iItem = lIndex - 1
    tLV.mask = LVIF_TEXT Or LVIF_IMAGE Or LVIF_PARAM Or LVIF_INDENT
 
    lR = SendMessage(Me.ListView1.Handle, LVM_INSERTITEM, 0&, tLV)
End Sub
 
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles Button1.Click
    fAddItem("test")
End Sub

Also, I have NOT tested this code. I've just corrected the obvious mistakes and reposted the code. I haven't run it through the compiler or tried to run it!


RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

GeneralRe: lvm_insertitem Pin
klaus_746-Jun-04 20:40
klaus_746-Jun-04 20:40 
GeneralDialog in a web page Pin
?!?5-Jun-04 2:24
?!?5-Jun-04 2:24 
GeneralRe: Dialog in a web page Pin
RichardGrimmer7-Jun-04 5:29
RichardGrimmer7-Jun-04 5:29 
GeneralAccess information from a query in a Access Pin
ccotton3334-Jun-04 5:31
ccotton3334-Jun-04 5:31 
GeneralAccess information from a query in a Access Pin
ccotton3334-Jun-04 5:30
ccotton3334-Jun-04 5:30 
GeneralRe: Access information from a query in a Access Pin
Mike Ellison4-Jun-04 7:09
Mike Ellison4-Jun-04 7:09 
GeneralRe: Access information from a query in a Access Pin
ccotton3334-Jun-04 7:27
ccotton3334-Jun-04 7:27 
GeneralRe: Access information from a query in a Access Pin
Dave Kreskowiak7-Jun-04 6:22
mveDave Kreskowiak7-Jun-04 6:22 
Generalhallo Pin
ymohd_2224-Jun-04 1:16
ymohd_2224-Jun-04 1:16 
GeneralRe: hallo Pin
RichardGrimmer4-Jun-04 2:09
RichardGrimmer4-Jun-04 2:09 
GeneralSend MsgBox to another User Pin
Member 5798973-Jun-04 22:24
Member 5798973-Jun-04 22:24 
GeneralRe: Send MsgBox to another User Pin
Dave Kreskowiak4-Jun-04 0:44
mveDave Kreskowiak4-Jun-04 0:44 
GeneralRe: Send MsgBox to another User Pin
tramdtt4-Jun-04 16:45
tramdtt4-Jun-04 16:45 
GeneralRestricting Pin
P.V.Velan3-Jun-04 20:29
P.V.Velan3-Jun-04 20:29 
GeneralRe: Restricting Pin
Dave Kreskowiak4-Jun-04 0:40
mveDave Kreskowiak4-Jun-04 0:40 
Generalextending my application wih a vba or vba.net programming environment Pin
jdebont3-Jun-04 11:52
jdebont3-Jun-04 11:52 
GeneralPortability Error Pin
Pugman8123-Jun-04 9:54
Pugman8123-Jun-04 9:54 

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.