I have list box populated with the dataReader. Then I add one item and I
want that this item would be the first one in the listBox.
Now, It's the last. Can I change the position of the item in the listBox
from the last to the first?
lstMedia.DataSo urce() = funkcije.create DataReader(sql, True)
lstMedia.DataVa lueField = "med_id"
lstMedia.DataTe xtField = "med_name"
lstMedia.DataBi nd()
Dim novItem As New ListItem
novItem.Text = "..."
novItem.Value = "0"
novItem.Selecte d = True
lstMedia.Items. Add(novItem) 2 2800
Hi Simon,
You can try one of the following
lstMedia.DataSo urce() = funkcije.create DataReader(sql, True)
lstMedia.DataVa lueField = "med_id"
lstMedia.DataTe xtField = "med_name"
lstMedia.DataBi nd()
lstMedia.items. insert(0,"Moham ed") ' If you don't want to add value
or
dim myListItem as new ListItem("Moham ed","150") 'if you want to add a
value to the item
lstMedia.items. insert(0,myList Item)
Best Regards
Mohamed Sharaf
"simon" <si*********@st ud-moderna.si> wrote in message
news:eN******** ******@TK2MSFTN GP10.phx.gbl... I have list box populated with the dataReader. Then I add one item and I want that this item would be the first one in the listBox. Now, It's the last. Can I change the position of the item in the listBox from the last to the first?
lstMedia.DataSo urce() = funkcije.create DataReader(sql, True) lstMedia.DataVa lueField = "med_id" lstMedia.DataTe xtField = "med_name" lstMedia.DataBi nd()
Dim novItem As New ListItem
novItem.Text = "..." novItem.Value = "0" novItem.Selecte d = True lstMedia.Items. Add(novItem)
thank you, it works now.
I missed the method insert, I only new for add method:)
Regards,
Simon
"Mohamed Sharaf" <mo************ @GOAWAYitworx.c om.PRIVACY> wrote in message
news:Ow******** ******@TK2MSFTN GP10.phx.gbl... Hi Simon, You can try one of the following lstMedia.DataSo urce() = funkcije.create DataReader(sql, True) lstMedia.DataVa lueField = "med_id" lstMedia.DataTe xtField = "med_name" lstMedia.DataBi nd() lstMedia.items. insert(0,"Moham ed") ' If you don't want to add value
or dim myListItem as new ListItem("Moham ed","150") 'if you want to add a value to the item lstMedia.items. insert(0,myList Item)
Best Regards Mohamed Sharaf
"simon" <si*********@st ud-moderna.si> wrote in message news:eN******** ******@TK2MSFTN GP10.phx.gbl... I have list box populated with the dataReader. Then I add one item and I want that this item would be the first one in the listBox. Now, It's the last. Can I change the position of the item in the listBox from the last to the first?
lstMedia.DataSo urce() = funkcije.create DataReader(sql, True) lstMedia.DataVa lueField = "med_id" lstMedia.DataTe xtField = "med_name" lstMedia.DataBi nd()
Dim novItem As New ListItem
novItem.Text = "..." novItem.Value = "0" novItem.Selecte d = True lstMedia.Items. Add(novItem)
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Irene |
last post by:
I'm developing a Web application where a user selects from a listbox which can have many items. The initial display only shows about 10 items.
After a postback, the listbox is automatically scrolled back to the top, so the selected item is mostly no longer visible. How can I keep the position, so that the selected item is still shown?
|
by: SamIAm |
last post by:
Hi
I have a ListBox called lstListOfStuff
I want to get the ordinal position of a ListItem so that I can insert a new
ListItem below it. How do I do this? I cannot find any members to give me
the index position of an item?
Thanks,
|
by: Alpha |
last post by:
I have 3 radio buttons for include, exclued or 'select all' from the listbox
items. If a user selects the 'Select All' button' then all items in listbox
is hi-lited as selected. Now, when user selects one item out of the 'all
selected' listing then there is now only one item selected. How and where
can I put in some code to change the selected radio button to the 'include'
since it is no longer in select all mode.
Thanks,
Alpha
|
by: Karen Grube |
last post by:
Hi!
I'm using a standard server side ASP.Net listbox control on a web form.
The page is basically various shades of green. The listbox itself has a pale
green background and forest green text and a forest green border. However,
when you move the cursor from one item to the next within the listbox or you
click on an item in the listbox to select it, the background turns to the
standard windows dark blue with white letters. Well, that...
|
by: Giovanni Bassi |
last post by:
Hello All,
I have a class implementing IList and a global object of this class type.
I have two different form objects. One has a ListBox and the other has
ComboBox. Both of their datasources are set to this global object.
The problem is that when I select an item in the ListBox the combobox
selecteditem changes to the same item selected in the ListBox. And the
oposite is also true, so when I select an item in the ComboBox my ListBox...
| |
by: Joe Fallon |
last post by:
I have a list box with 7 text values in it.
I have a pair of buttons to Move Up or Move Down the selected item one
position.
What is the simplest way to code the buttons so the item moves one position?
--
Joe Fallon
|
by: Randy |
last post by:
Hi,
I'm have a form with a listbox and a few textboxes on it. Based on
the user's selection in the listbox, I want the bindingsource to
update the textboxes with the corresponding values. I have similar
code built for a combobox that works just fine, but when applying it
to a listbox bound to a dataview, I can't figure out how to return the
correct bindingsource index. No matter what item I select, my index
returns 0.
Private Sub...
|
by: Lit |
last post by:
Hi,
How can I capture the vertical scroll bar position for a Listbox.
I have a Listbox of 100 items + when I click on it I post back remove the
item selected.
After returning to the client browser the list box scroll position is at the
top.
|
by: CSharper |
last post by:
Is it possible to selectivly change the color of an item in text. I
saw ForeColor option, but it changes the color of all the items. If it
is not possible, is there any other control list listbox where we can
see more than one item and change the color during run time.
Thanks.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |