Home All Groups Group Topic Archive Search About

le nom 'vb6' n'est pas déclaré

Author
7 Jun 2006 3:01 PM
Pascal
bonjour vb2005 m'annonce :
le nom 'vb6' n'est pas déclaré



que dois je déclarer pour utliser VB6.SetItemData ?

For lPointer = 0 To lCount
VB6.SetItemData(Me.lstMots, lPointer, 0)
'.SelectedItem (lpointer).
Next

merci
http://www.scalpa.info

Author
7 Jun 2006 3:49 PM
Cor Ligthert [MVP]
Pascal,

Probably much, however if you want to know it, than you have to ask in this
international newsgroup the question in English, what is for a great part of
the regulars not their first language.

Alternatively you can visit an newsgroup special for the French Visual
Studio.

almost the same as this one however after
microsoft.public.fr.dotnet.languages.vb

Cor

Show quoteHide quote
"Pascal" <scalpano***@wanadoo.rf> schreef in bericht
news:4486ea14$0$831$ba4acef3@news.orange.fr...
> bonjour vb2005 m'annonce :
> le nom 'vb6' n'est pas déclaré
>
>
>
> que dois je déclarer pour utliser VB6.SetItemData ?
>
> For lPointer = 0 To lCount
> VB6.SetItemData(Me.lstMots, lPointer, 0)
> '.SelectedItem (lpointer).
> Next
>
> merci
> http://www.scalpa.info
>
Author
7 Jun 2006 5:45 PM
Pascal
ooops, sorry !
i try in english
the name vb6 is not declared...
in my program i would like to use vb6.setitemdata, VB6.ListBoxItem,
VB6.SetItemDat, VB6.GetItemString,
vb6.GetItemData
like this :
For i = 0 To lCount
VB6.SetItemData(Me.listbox1, i, 0)
Next

but when i debugg (?) with F5 the message says :

"the name vb6 is not declared"...

so i think i have to declare the vb6 compatibility somewhere but where and
how.... that is the question !
Microsoft.VisualBasic.Compatibility.VB6

if i try like this :
If Microsoft.VisualBasic.Compatibility.VB6.GetItemData(Me.lstMots, lPointer)
<> -1 Then ...
the message (after F5) says : "compatibility is not a member of visualbasic"

i made a reference to the microsoftvisualbasic.compatibility in my
project...


so now what can i try else ?
thanks

http://www.scalpa.info
Author
7 Jun 2006 6:03 PM
Cor Ligthert [MVP]
Pascal,

Why would you use a compatible namespace if there is so much for dates in
Net and in the normal Microsoft Visual Basic namespace.

Probably somebody just ended with VB6 knows already the answer.

Can you describe what you need for date?

Cor

Show quoteHide quote
"Pascal" <scalpano***@wanadoo.rf> schreef in bericht
news:44871078$0$887$ba4acef3@news.orange.fr...
> ooops, sorry !
> i try in english
> the name vb6 is not declared...
> in my program i would like to use vb6.setitemdata, VB6.ListBoxItem,
> VB6.SetItemDat, VB6.GetItemString,
> vb6.GetItemData
> like this :
> For i = 0 To lCount
> VB6.SetItemData(Me.listbox1, i, 0)
> Next
>
> but when i debugg (?) with F5 the message says :
>
> "the name vb6 is not declared"...
>
> so i think i have to declare the vb6 compatibility somewhere but where and
> how.... that is the question !
> Microsoft.VisualBasic.Compatibility.VB6
>
> if i try like this :
> If Microsoft.VisualBasic.Compatibility.VB6.GetItemData(Me.lstMots,
> lPointer) <> -1 Then ...
> the message (after F5) says : "compatibility is not a member of
> visualbasic"
>
> i made a reference to the microsoftvisualbasic.compatibility in my
> project...
>
>
> so now what can i try else ?
> thanks
>
> http://www.scalpa.info
>
Author
7 Jun 2006 9:01 PM
Pascal
good night

I try to reuse an old vb6 sub where the catch is to sort the items of a
listbox regarding the length of each item. (number of characters).
I am a newbee among the newbees... i suspect there is a way doing this job
in another way : making a new user control with a listbox and some buttons :
one to open a text and with a streamreader put its content in the
listbox,one to clear the list, one to "update the selected word" in the list
by its modified copy from a textbox where i made the changement (by clicking
on a word in the list box you fill a textbox where man modify this item),
one to save the list in a text file with a streamwriter, and one to sort the
items by their length... len(trim$(theWord).......... should be Eaven !

but now just making this sub working should be great. i don't know where
there is a mistake..
Sub ListBoxControl(ByRef sMode As String)

' ***********************************************

' MODE OPERATION

' ---- ---------

' SAVE Save the new word

' CLEAR Clear the list box

' DELETE Remove the selected word

' SORT Sort the list from Longest to Shortest word

' ************************************************

Dim lPointer As Integer

Dim lCount As Integer

With Me.lstMots

Select Case UCase(sMode)

Case "SORT" ' by the longest word to the shortest

Dim sLastWord As String = ""

Dim bFlg As Boolean

Dim lWordCount As Integer

Dim lUpper As Integer

Dim bSortLoopFlg As Boolean

lCount = .Items.Count - 1

' *** set the item data to 0

' this will be used as a flag later

For lPointer = 0 To lCount

VB6.SetItemData(Me.lstMots, lPointer, 0)

'.SelectedItem (lpointer).

Next

ReDim aryListBox(0)

bSortLoopFlg = False

Do Until bSortLoopFlg = True

bFlg = True

bSortLoopFlg = True

For lPointer = 0 To lCount

If bFlg = True Then

' *** get the first word that the item data is zero

If VB6.GetItemData(Me.lstMots, lPointer) <> -1 Then

bSortLoopFlg = False

' *** get the first word

sLastWord = VB6.GetItemString(Me.lstMots, lPointer)

lWordCount = lPointer

bFlg = False

End If '»If .ItemData(lPointer) <> -1 Then

Else

' *** get the next word that the item data is zero

If VB6.GetItemData(Me.lstMots, lPointer) <> -1 Then

' *** we still have words to check

bSortLoopFlg = False

' *** find the largest

If Len(Trim(sLastWord)) < Len(Trim(VB6.GetItemString(Me.lstMots, lPointer)))
Then

sLastWord = VB6.GetItemString(Me.lstMots, lPointer)

lWordCount = lPointer

End If '»If Len(sLastWord) < .List(lPointer) Then

End If '»If .ItemData(lPointer) <> -1 Then

End If '»If bFlg = True Then

Next '»For lPointer = 0 To lCount

lUpper = UBound(aryListBox, 1) + 1

ReDim Preserve aryListBox(lUpper)

aryListBox(lUpper) = sLastWord

VB6.SetItemData(Me.lstMots, lWordCount, -1)

Label1.Text = sLastWord

Loop '»Do Until bSortLoopFlg = True

Case "DELETE"

If .SelectedItems.Count = 0 Then Exit Sub

lCount = .Items.Count - 1

For lPointer = 0 To lCount

If .GetSelected(lPointer) = True Then

..Items.RemoveAt(lPointer)

Exit Sub

End If '»If .Selected(lPointer) = True Then

Next '»For lPointer = 0 To lCount

Case "SAVE"

..Items.Add(New VB6.ListBoxItem(UCase(Me.txtMotInput.Text), 0))

Me.txtMotInput.Text = ""

Me.txtMotInput.Focus()

Case "CLEAR"

..Items.Clear()

'Me.txtWord.Text = ""

Me.txtMotInput.Text = ""

'Me.cmdStart.Enabled = False

'Me.cmdAuto.Enabled = False

'Me.cmdFinish.Enabled = False

'Me.cmdExport.Enabled = False

Me.txtMotInput.Focus()

End Select '»Select Case UCase$(sMode)

End With '»With frmMain.lstInputWord

End Sub

Too hard for me.....
Author
8 Jun 2006 10:03 AM
Cor Ligthert [MVP]
Pascal,

Is this lazy way something for you?
\\\
Dim it As New SortedList
it.Add("Twee".Length, "Twee")
it.Add("Een".Length, "Een")
For Each di As DictionaryEntry In it
   ListBox1.Items.Add(di.Value)
Next
///

Where I use direct strings you can of course use a fieldname to make it more
usable

I hope this helps,

Cor

ascal" <scalpano***@wanadoo.rf> schreef in bericht
Show quoteHide quote
news:44873ea1$0$941$ba4acef3@news.orange.fr...
> good night
>
> I try to reuse an old vb6 sub where the catch is to sort the items of a
> listbox regarding the length of each item. (number of characters).
> I am a newbee among the newbees... i suspect there is a way doing this job
> in another way : making a new user control with a listbox and some buttons
> : one to open a text and with a streamreader put its content in the
> listbox,one to clear the list, one to "update the selected word" in the
> list by its modified copy from a textbox where i made the changement (by
> clicking on a word in the list box you fill a textbox where man modify
> this item), one to save the list in a text file with a streamwriter, and
> one to sort the items by their length... len(trim$(theWord)..........
> should be Eaven !
>
> but now just making this sub working should be great. i don't know where
> there is a mistake..
> Sub ListBoxControl(ByRef sMode As String)
>
> ' ***********************************************
>
> ' MODE OPERATION
>
> ' ---- ---------
>
> ' SAVE Save the new word
>
> ' CLEAR Clear the list box
>
> ' DELETE Remove the selected word
>
> ' SORT Sort the list from Longest to Shortest word
>
> ' ************************************************
>
> Dim lPointer As Integer
>
> Dim lCount As Integer
>
> With Me.lstMots
>
> Select Case UCase(sMode)
>
> Case "SORT" ' by the longest word to the shortest
>
> Dim sLastWord As String = ""
>
> Dim bFlg As Boolean
>
> Dim lWordCount As Integer
>
> Dim lUpper As Integer
>
> Dim bSortLoopFlg As Boolean
>
> lCount = .Items.Count - 1
>
> ' *** set the item data to 0
>
> ' this will be used as a flag later
>
> For lPointer = 0 To lCount
>
> VB6.SetItemData(Me.lstMots, lPointer, 0)
>
> '.SelectedItem (lpointer).
>
> Next
>
> ReDim aryListBox(0)
>
> bSortLoopFlg = False
>
> Do Until bSortLoopFlg = True
>
> bFlg = True
>
> bSortLoopFlg = True
>
> For lPointer = 0 To lCount
>
> If bFlg = True Then
>
> ' *** get the first word that the item data is zero
>
> If VB6.GetItemData(Me.lstMots, lPointer) <> -1 Then
>
> bSortLoopFlg = False
>
> ' *** get the first word
>
> sLastWord = VB6.GetItemString(Me.lstMots, lPointer)
>
> lWordCount = lPointer
>
> bFlg = False
>
> End If '»If .ItemData(lPointer) <> -1 Then
>
> Else
>
> ' *** get the next word that the item data is zero
>
> If VB6.GetItemData(Me.lstMots, lPointer) <> -1 Then
>
> ' *** we still have words to check
>
> bSortLoopFlg = False
>
> ' *** find the largest
>
> If Len(Trim(sLastWord)) < Len(Trim(VB6.GetItemString(Me.lstMots,
> lPointer))) Then
>
> sLastWord = VB6.GetItemString(Me.lstMots, lPointer)
>
> lWordCount = lPointer
>
> End If '»If Len(sLastWord) < .List(lPointer) Then
>
> End If '»If .ItemData(lPointer) <> -1 Then
>
> End If '»If bFlg = True Then
>
> Next '»For lPointer = 0 To lCount
>
> lUpper = UBound(aryListBox, 1) + 1
>
> ReDim Preserve aryListBox(lUpper)
>
> aryListBox(lUpper) = sLastWord
>
> VB6.SetItemData(Me.lstMots, lWordCount, -1)
>
> Label1.Text = sLastWord
>
> Loop '»Do Until bSortLoopFlg = True
>
> Case "DELETE"
>
> If .SelectedItems.Count = 0 Then Exit Sub
>
> lCount = .Items.Count - 1
>
> For lPointer = 0 To lCount
>
> If .GetSelected(lPointer) = True Then
>
> .Items.RemoveAt(lPointer)
>
> Exit Sub
>
> End If '»If .Selected(lPointer) = True Then
>
> Next '»For lPointer = 0 To lCount
>
> Case "SAVE"
>
> .Items.Add(New VB6.ListBoxItem(UCase(Me.txtMotInput.Text), 0))
>
> Me.txtMotInput.Text = ""
>
> Me.txtMotInput.Focus()
>
> Case "CLEAR"
>
> .Items.Clear()
>
> 'Me.txtWord.Text = ""
>
> Me.txtMotInput.Text = ""
>
> 'Me.cmdStart.Enabled = False
>
> 'Me.cmdAuto.Enabled = False
>
> 'Me.cmdFinish.Enabled = False
>
> 'Me.cmdExport.Enabled = False
>
> Me.txtMotInput.Focus()
>
> End Select '»Select Case UCase$(sMode)
>
> End With '»With frmMain.lstInputWord
>
> End Sub
>
> Too hard for me.....
>
>
Author
8 Jun 2006 8:39 PM
Pascal
hello

yes but what happen when several words have got the same length. Is  it a
problem or not ? because there is a message box that pops every time to
inform the user. So is the length parameter a key or not ? Can we have the
key "7" two times ?

thanks
Author
9 Jun 2006 1:16 PM
Cor Ligthert [MVP]
Pascal,

Sory I use forever for this kind of things a datatable, however I did use
this time another one.

This is with the datatable.

\\\
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
        Dim dt As New DataTable
        dt.Columns.Add("length", GetType(System.Int32))
        dt.Columns.Add("text")
        addIt("Twee", dt) 'Deux
        addIt("Een", dt) 'Un
        addIt("Drie", dt) 'Trois
        dt.DefaultView.Sort = "length"
        ListBox1.DataSource = dt.DefaultView
        ListBox1.DisplayMember = "text"
    End Sub
    Private Sub addIt(ByVal field As String, _
    ByVal dt As DataTable)
        dt.LoadDataRow(New Object() {field.Length, field}, True)
    End Sub
End Class
///

I hope this goes better.

Cor

Show quoteHide quote
"Pascal" <scalpano***@wanadoo.rf> schreef in bericht
news:44888aeb$0$856$ba4acef3@news.orange.fr...
> hello
>
> yes but what happen when several words have got the same length. Is  it a
> problem or not ? because there is a message box that pops every time to
> inform the user. So is the length parameter a key or not ? Can we have the
> key "7" two times ?
>
> thanks
>
Author
9 Jun 2006 10:28 PM
Pascal
Yes it works... big step Thank you. Is there a way to reverse the order in
the same maner than array.reverse ?
I seek around this method, try to convert the data into this kind of array
in order to reverse the list without success. only sort method exist for the
datatable : it's strange ! no ?
in the code i load a word list to test it .i notice the
"'ListBox1.Items.Add(TextBox1.Text) does not work anymore"
Public Class Form2

Private dt As New DataTable

Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load

dt.Columns.Add("length", GetType(System.Int32))

dt.Columns.Add("text")

Try

Dim fileReader As System.IO.StreamReader

fileReader = My.Computer.FileSystem.OpenTextFileReader("c:\liste.txt") ',
System.Text.Encoding.Unicode

Dim stringReader As String = ""

Dim i As Integer = 0

ListBox1.Items.Clear()

While Not fileReader.EndOfStream

stringReader = (Trim(fileReader.ReadLine())).ToUpper 'ne tiens pas compte
des majuscules

addIt(stringReader, dt)

'ListBox1.Items.Add(stringReader)

End While

fileReader.Close()

dt.DefaultView.Sort = "length"

ListBox1.DataSource = dt.DefaultView

ListBox1.DisplayMember = "text"

Catch fileException As Exception

Throw fileException

End Try

End Sub

Private Sub addIt(ByVal field As String, ByVal dt As DataTable)

dt.LoadDataRow(New Object() {field.Length, field}, True)

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

If TextBox1.Text = "" Then

MsgBox("Please add text before adding a item")

Else

' Stop the ListBox from drawing while items are added.

ListBox1.BeginUpdate()

'Adds the text from Textbox1 to Listbox1 the :

addIt(TextBox1.Text, dt)

' End the update process and force a repaint of the ListBox.

ListBox1.EndUpdate()

TextBox1.Text = ""

End If

End Sub

End Class

have a good night

pascal
Author
10 Jun 2006 4:59 AM
Cor Ligthert [MVP]
Desc or Asc in the sort string

I thought that a French those from the French language derived words should
recognize direct.

http://msdn2.microsoft.com/en-us/library/system.data.dataview.rowfilter.aspx

Cor

Show quoteHide quote
"Pascal" <scalpano***@wanadoo.rf> schreef in bericht
news:4489f5e5$0$827$ba4acef3@news.orange.fr...
> Yes it works... big step Thank you. Is there a way to reverse the order in
> the same maner than array.reverse ?
> I seek around this method, try to convert the data into this kind of array
> in order to reverse the list without success. only sort method exist for
> the datatable : it's strange ! no ?
> in the code i load a word list to test it .i notice the
> "'ListBox1.Items.Add(TextBox1.Text) does not work anymore"
> Public Class Form2
>
> Private dt As New DataTable
>
> Private Sub Form2_Load(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Me.Load
>
> dt.Columns.Add("length", GetType(System.Int32))
>
> dt.Columns.Add("text")
>
> Try
>
> Dim fileReader As System.IO.StreamReader
>
> fileReader = My.Computer.FileSystem.OpenTextFileReader("c:\liste.txt") ',
> System.Text.Encoding.Unicode
>
> Dim stringReader As String = ""
>
> Dim i As Integer = 0
>
> ListBox1.Items.Clear()
>
> While Not fileReader.EndOfStream
>
> stringReader = (Trim(fileReader.ReadLine())).ToUpper 'ne tiens pas compte
> des majuscules
>
> addIt(stringReader, dt)
>
> 'ListBox1.Items.Add(stringReader)
>
> End While
>
> fileReader.Close()
>
> dt.DefaultView.Sort = "length"
>
> ListBox1.DataSource = dt.DefaultView
>
> ListBox1.DisplayMember = "text"
>
> Catch fileException As Exception
>
> Throw fileException
>
> End Try
>
> End Sub
>
> Private Sub addIt(ByVal field As String, ByVal dt As DataTable)
>
> dt.LoadDataRow(New Object() {field.Length, field}, True)
>
> End Sub
>
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
>
> If TextBox1.Text = "" Then
>
> MsgBox("Please add text before adding a item")
>
> Else
>
> ' Stop the ListBox from drawing while items are added.
>
> ListBox1.BeginUpdate()
>
> 'Adds the text from Textbox1 to Listbox1 the :
>
> addIt(TextBox1.Text, dt)
>
> ' End the update process and force a repaint of the ListBox.
>
> ListBox1.EndUpdate()
>
> TextBox1.Text = ""
>
> End If
>
> End Sub
>
> End Class
>
> have a good night
>
> pascal
>
>