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 9 2350
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
"Pascal" <sc*********@wanadoo.rf> schreef in bericht
news:44*********************@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
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.GetItemDat a(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
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
"Pascal" <sc*********@wanadoo.rf> schreef in bericht
news:44*********************@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.GetItemDat a(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
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.....
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" <sc*********@wanadoo.rf> schreef in bericht
news:44*********************@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.....
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
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
"Pascal" <sc*********@wanadoo.rf> schreef in bericht
news:44*********************@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
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:\list e.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
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/lib...rowfilter.aspx
Cor
"Pascal" <sc*********@wanadoo.rf> schreef in bericht
news:44*********************@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:\list e.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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Raymond H. |
last post by:
Bonjour,
Est-il possible d'exécuter seulement un msgbox dans l'événement clik
d'une ToolBar mais sans que le bouton en question (de la ToolBar) ne
s'enfonce mais reste normal sans enfoncement ?...
|
by: Gilles Cadorel |
last post by:
Sur un PC, nous avons installé plusieurs version d'Oracle Client.
Plusieurs logiciels tiers utilisant Oracle ne demandent pas lors de
leur installation, quelle version d'Oracle utiliser.
Ces...
|
by: DJ WIce |
last post by:
Hi,
I'm looking for a script to get the hi-est z-index on a page.
I want my javascript menu to be always on top of the page (moves along on
top when you scroll down).
Does anyone know how to...
|
by: Simbad |
last post by:
Question ?
Est-ce que l'on peut installer VB6 sur le même pc avec VB.net ? Plusieurs
utilisateurs me dise que non ?
Merci
Paul B.
|
by: Narendra |
last post by:
Hi All,
i got a problem. I need to convert time from EST standard to PST
standard.
Thu, 15 Dec 2005 09:24:19 -0500 to PST
this time i need to convert as PST time
is there any python code...
| |
by: sunway |
last post by:
est
--
free thought,free world
|
by: gunimpi |
last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431
********************************************************
VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help
wanted...
|
by: AG |
last post by:
Bonjour,
voici mon bout de code (toujours le même en amélioré). Ma question est la
suivante :
combien de tableau tab ai-je ? Moi j'en veux que deux. Un pour myA1 et un
pour myA2. Le fait que...
|
by: =?Utf-8?B?UGhpbCBKb2huc29u?= |
last post by:
Hi,
I have a web application that will be hosted on servers with timezones
configured to EST with daylight saving.
My application takes an XML datafeed that contains times in GMT (also with...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |