Hello.
/windows forms/
I'm marking listbox items as selected, and I'd like to scroll listbox to
a selected entry if it is off-screen. How can I do it?
--
Semper Fidelis
Adam Klobukowski at***@gabo.pl 6 11538
Adam Klobukowski <at***@gabo.p l> wrote in
news:cn******** **@nemesis.news .tpi.pl: Hello.
/windows forms/ I'm marking listbox items as selected, and I'd like to scroll listbox to a selected entry if it is off-screen. How can I do it?
Adam,
Setting ListBox.Selecte dIndex should automatically scroll the listbox
to the selected item.
--
Hope this helps.
Chris.
-------------
C.R. Timmons Consulting, Inc. http://www.crtimmonsinc.com/
Chris R. Timmons napisa³(a): Adam Klobukowski <at***@gabo.p l> wrote in news:cn******** **@nemesis.news .tpi.pl:
Hello.
/windows forms/ I'm marking listbox items as selected, and I'd like to scroll listbox to a selected entry if it is off-screen. How can I do it?
Adam,
Setting ListBox.Selecte dIndex should automatically scroll the listbox to the selected item.
Ok, but ListBox.Selecte dIndex is read only. Should I use property or
method of it? If yes, which one?
I tried something like this:
s_lv.Items[ret].Selected = true;
rozlacz.Enabled = true;
s_lv.SelectedIt ems[ret].Selected =true;
But it doesn't work :(
--
Semper Fidelis
Adam Klobukowski at***@gabo.pl
Adam Klobukowski napisa³(a): Chris R. Timmons napisa³(a):
Adam Klobukowski <at***@gabo.p l> wrote in news:cn******** **@nemesis.news .tpi.pl:
Hello.
/windows forms/ I'm marking listbox items as selected, and I'd like to scroll listbox to a selected entry if it is off-screen. How can I do it? Adam,
Setting ListBox.Selecte dIndex should automatically scroll the listbox to the selected item.
Ok, but ListBox.Selecte dIndex is read only. Should I use property or method of it? If yes, which one?
I tried something like this: s_lv.Items[ret].Selected = true; rozlacz.Enabled = true; s_lv.SelectedIt ems[ret].Selected =true;
But it doesn't work :(
Damn I made mess ;)
It should be:
s_lv.Items[ret].Selected = true;
s_lv.SelectedIt ems[0].Selected =true;
And it is not a lisbox but listview and it has multiselect=fal se property.
--
Semper Fidelis
Adam Klobukowski at***@gabo.pl
ListBox.Selecte dIndex is read/write, so just set it to the zero based index
you want to be selected in the listbox.
s_lv.SelectedIn dex = 3;
--Liam.
"Adam Klobukowski" <at***@gabo.p l> wrote in message
news:cn******** **@atlantis.new s.tpi.pl... Chris R. Timmons napisa³(a): Adam Klobukowski <at***@gabo.p l> wrote in news:cn******** **@nemesis.news .tpi.pl:
Hello.
/windows forms/ I'm marking listbox items as selected, and I'd like to scroll listbox to a selected entry if it is off-screen. How can I do it?
Adam,
Setting ListBox.Selecte dIndex should automatically scroll the listbox to the selected item.
Ok, but ListBox.Selecte dIndex is read only. Should I use property or method of it? If yes, which one?
I tried something like this: s_lv.Items[ret].Selected = true; rozlacz.Enabled = true; s_lv.SelectedIt ems[ret].Selected =true;
But it doesn't work :(
-- Semper Fidelis
Adam Klobukowski at***@gabo.pl
Adam Klobukowski <at***@gabo.p l> wrote in
news:cn******** **@atlantis.new s.tpi.pl: Adam Klobukowski napisa³(a): Chris R. Timmons napisa³(a):
Adam Klobukowski <at***@gabo.p l> wrote in news:cn******** **@nemesis.news .tpi.pl:
Hello.
/windows forms/ I'm marking listbox items as selected, and I'd like to scroll listbox to a selected entry if it is off-screen. How can I do it? Adam,
Setting ListBox.Selecte dIndex should automatically scroll the listbox to the selected item.
Ok, but ListBox.Selecte dIndex is read only. Should I use property or method of it? If yes, which one?
I tried something like this: s_lv.Items[ret].Selected = true; rozlacz.Enabled = true; s_lv.SelectedIt ems[ret].Selected =true;
But it doesn't work :(
Damn I made mess ;)
It should be:
s_lv.Items[ret].Selected = true; s_lv.SelectedIt ems[0].Selected =true;
And it is not a lisbox but listview and it has multiselect=fal se property.
Adam,
Try this:
this.listView1. Select();
this.listView1. Items[ret].Selected = true;
this.listView1. EnsureVisible(r et);
The ListView has to be selected before it will honor a request to
programmaticall y select an item (I don't know why...).
--
Hope this helps.
Chris.
-------------
C.R. Timmons Consulting, Inc. http://www.crtimmonsinc.com/
Chris R. Timmons napisa³(a): Adam Klobukowski <at***@gabo.p l> wrote in news:cn******** **@atlantis.new s.tpi.pl:
Adam Klobukowski napisa³(a):
Chris R. Timmons napisa³(a):
Adam Klobukowski <at***@gabo.p l> wrote in news:cn**** ******@nemesis. news.tpi.pl:
>Hello. > >/windows forms/ >I'm marking listbox items as selected, and I'd like to scroll >listbox to a selected entry if it is off-screen. How can I do >it? Adam,
Setting ListBox.Selecte dIndex should automatically scroll the listbox to the selected item.
Ok, but ListBox.Selecte dIndex is read only. Should I use property or method of it? If yes, which one?
I tried something like this: s_lv.Items[ret].Selected = true; rozlacz.Enab led = true; s_lv.Selecte dItems[ret].Selected =true;
But it doesn't work :(
Damn I made mess ;)
It should be:
s_lv.Items[ret].Selected = true; s_lv.Selected Items[0].Selected =true;
And it is not a lisbox but listview and it has multiselect=fal se property.
Adam,
Try this:
this.listView1. Select(); this.listView1. Items[ret].Selected = true; this.listView1. EnsureVisible(r et);
The ListView has to be selected before it will honor a request to programmaticall y select an item (I don't know why...).
It works, thanks.
--
Semper Fidelis
Adam Klobukowski at***@gabo.pl This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Filips Benoit |
last post by:
Dear All,
I have code that selects - find and select - 1 item in a large listbox. This
works Ok but most of the time the selected item isn't visible without
scrolling down manualy. Is this possible by code?
Filip
|
by: deko |
last post by:
I have an Access 2003 mdb with a Main Form that has a ListBox with a long
list of items. The problem is the scroll bar on the ListBox does not scroll
all the way to the end unless you first scroll half way, then let up the
left mouse button, and then continue to scroll to the end of the list. But
once you've scrolled the entire list once, the scroll bar works fine.
The Main Form gets requeried at times due to different events which puts...
|
by: Keltus |
last post by:
Hello,
I have a Form with a ListBox in it. I'd like to be able to scroll the
ListBox even when it's not in focus. ie. when i scroll the mousewheel
when my focus is on the form, I'd like the ListBox to scroll. Now,
there are two ways I would think would work. The first is if I can
resend the MouseEventArgs to the ListBox but there does not seen to be
a way to pass that event along. The second is if I could manually
scroll the ListBox...
|
by: Daniel |
last post by:
hi,
I had an asp:listbox, and everytime i click item inside, the bar
automatically go to the top, is there any way to keep the scroll position?
I turn on the smartNavigation, it still doesn't work.
Thanks ahead.
|
by: John |
last post by:
Hi,
I'm currently working on a simple project (for study on C#) with an
input (maskedtextbox) and a listbox. The input numbers are send in the
listbox.
When the listbox is filled with numbers it automaticly puts the
scrollbar in the listbox, thats fine but it doesn't scroll down to the
last number that was keyed in and isn't visible. You have to scroll
down in the listbox itself to make the last number that was entered
visible.
| |
by: superjacent |
last post by:
Hope someone can help.
I have a listbox displaying time periods in blocks of 15 mins for a 24
hour period, all up 96 rows.
The listbox can only visibly show 20 rows a time.
The default feature is that the first row is at the top of the listbox.
|
by: R.Nijkamp |
last post by:
Hello,
i was wondering if its an limitation of IE when a asp.net listbox is set
disabled, then a user wont be able to scroll inside the listbox. While the
user can scroll inside the listbox when he uses firefox.
Below a simple code which i tested:
<form id="Form1" runat="server">
<asp:ListBox id="drop1" rows="3" runat="server" disabled>
|
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: WRH |
last post by:
Hello
I want to have a multicolumn listbox. I never used one before
so I looked at a Help example. I set the multicolumn property and
the column width and tested with this example...
this.listBox3.Items.AddRange(new object
{
"Item 1, column 1",
"Item 2, column 1",
"Item 3, column 1",
|
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: 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: 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...
| |