hello
i would like to upgrade this code to vbnet, i tried without success:
Sub ListBoxControl( ByRef sMode As String)
Dim aryListBox() As String
Dim aryMain(,) As String
Dim aryTemp(,) As String
Dim glWordCount As Integer
' *************** *************** *************** **
' 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)
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.GetItemStri ng(Me.lstMots, lPointer)
lWordCount = lPointer
bFlg = False
End If '»If .ItemData(lPoin ter) <> -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(sLastW ord)) < Len(Trim(VB6.Ge tItemString(Me. lstMots, lPointer)))
Then
sLastWord = VB6.GetItemStri ng(Me.lstMots, lPointer)
lWordCount = lPointer
End If '»If Len(sLastWord) < .List(lPointer) Then
End If '»If .ItemData(lPoin ter) <> -1 Then
End If '»If bFlg = True Then
Next '»For lPointer = 0 To lCount
lUpper = UBound(aryListB ox, 1) + 1
ReDim Preserve aryListBox(lUpp er)
aryListBox(lUpp er) = 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(lP ointer) = True Then
..Items.RemoveA t(lPointer)
Exit Sub
End If '»If .Selected(lPoin ter) = True Then
Next '»For lPointer = 0 To lCount
Case "SAVE"
..Items.Add(New VB6.ListBoxItem (UCase(Me.txtMo tInput.Text), 0))
Me.txtMotInput. Text = ""
Me.txtMotInput. Focus()
Case "CLEAR"
..Items.Clear()
'Me.txtWord.Tex t = ""
Me.txtMotInput. Text = ""
Me.txtMotInput. Focus()
End Select '»Select Case UCase$(sMode)
End With '»With frmMain.lstInpu tWord
End Sub
End Class 1 4788
You have to add a refference to Microsoft.Visua lBasic.Compatib ility and
after in the code :
for example
:
For lPr = 0 To lCount
Compatibility.V B6.SetItemData( Me.listbox1, lPointer, 0) 'instead of
VB6.SetItemData (Me.listbox1, lPr, 0
Next http://www.scalpa.info This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Piet |
last post by:
Hi there.
I am trying to display tabular data in a wxListCtrl. What I get from
the script below are only the headers, not the items themselves. The
documentation didn´t help me much; instead I was lost in ListItemId´s
and different possibilities of inserting items and strings. I am sure
the solution is only one step away, but I need somebody to point in
the direction. Heres the script:
from wxPython.wx import *
class...
|
by: RICKY |
last post by:
hi,Does anyone know how to get text longer than a column in a listview
in c#?
This is easy in c++.you only have to check the LVS_OWNERDRAWFIXED
style.
then you only have to call the CListCtrl method
MyListCtrl.SetItemData(rownumber,0).
where rownumber is the item you want the text to spread over all other
columns.
|
by: Daniel P. |
last post by:
Is there anything similar to what MFC has, like CListBox::SetItemData ?
Thanks!
|
by: PL |
last post by:
Hi all,
What is the equivalent to C++ ListView methods GetItemData and SetItemData
in the C# ListView component?
Regards,
PL
|
by: Martin |
last post by:
Hi all!
In VB6.0 A combobox had items, which basically were the description and
ItemData which could be used to create a link to a record, that is if the
recordset had a numeric key.
I was hoping that in VB2005 this would have been changed to an alphanumeric
itemdata, so that no longer need to create an array "on the side" to store
the key values. But I can't even find the itemdata anymore.
| |
by: Pascal |
last post by:
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).
|
by: Sandy |
last post by:
HI All,
I have created a MFC exe using VC++ .NET 2003 on Windows XP Prof
service pack 2 and it works properly on my machine, but when I run the
same exe on a different machine (Windows XP Prof SP-2), The application
is bought up and after some time its throwing a windows xp error dialog
box saying,
I am also running the same application on 2 more machines there
|
by: Sandy |
last post by:
HI All,
I have created a MFC exe using VC++ .NET 2003 on Windows XP Prof
service pack 2 and it works properly on my machine, but when I run the
same exe on a different machine (Windows XP Prof SP-2), The application
is bought up and after some time its throwing a windows xp error dialog
box saying,
I am also running the same application on 2 more machines there
|
by: Studlyami |
last post by:
Alright, I have a list which is constantly getting items added and items removed. I want the user to be able to click the header of the list control and sort the items by the column clicked. Ive searched around and the best description i could fine is this. Now here is what i have.
I have captured the user clicking on the header and i have the column in which the user clicked. I have a feeling its how I'm entering data into the list...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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 we have to send another system
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |