CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 7/19/2004 4:08:27 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 4 Views: 26 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
5 Items, 1 Pages 1 |< << Go >> >|
learnerM
Asp.Net User
ListBox view text by index7/19/2004 4:08:27 PM

0/0

Hi everyone,
I am trying to view items in a listbox by the index they are stored. but I donno what function to use in c#. I want to store those items each at a time in the database. What function do I have to use? Can someone help me?
Thank you.
llangleyben
Asp.Net User
Re: ListBox view text by index7/19/2004 6:54:26 PM

1/1

Each ListItem have properties text, value and selected. Iterate through Items collection and store selected items to database one by one.

If it is not helping, can you be little more specific?
Leon Langleyben

MCSD, ASP.NET MVP

Blog
learnerM
Asp.Net User
Re: ListBox view text by index7/20/2004 1:14:18 PM

1/1

Hi llangelyben,
Thank you for the reply.
Actually my problem is I am dynamically adding items to the listBox. So I donno the 'value' of the text in it. I wanted to get those items like StoreInDb(Items[i]) from the whole list but not the selected item.
But now I chose the second option which is to create a System.Array and store all the text values in it and then put that Array in the iteration.
Here is the code where I used copyTo
Array strArray=Array.CreateInstance(typeof(System.Web.UI.WebControls.ListItem), ListBox1.Items.Count);
ListBox1.Items.CopyTo(strArray,0);
for(int i=0;i<ListBox1.Items.Count;i++)
{
insertIntoDb( strArray.GetValue(i).ToString() );
}
So this method worked but I am still not satisfied becoz Array occupies more memory. If there is any function like ' string ListBox1.getTextByIndex(int index) ' please let me know.
Thank you.
llangleyben
Asp.Net User
Re: ListBox view text by index7/20/2004 2:53:37 PM

0/0

Why not just scan Items collection directly?

for(int i=0;i<ListBox1.Items.Count;i++)
{
if (!ListBox1.Items[i].Selected)
insertIntoDb(ListBox1.Items[i].Text);
}

Leon Langleyben

MCSD, ASP.NET MVP

Blog
learnerM
Asp.Net User
Re: ListBox view text by index7/21/2004 5:53:33 PM

0/0

Thank you very much.
It worked and reduced my lines of code.
Thank you once again.
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Sams Teach Yourself Visual Basic 2005 in 24 Hours: Complete Starter Kit Authors: James D. Foxall, Pages: 536, Published: 2006
Perl in a Nutshell: A Desktop Quick Reference Authors: Nathan Patwardhan, Ellen Siever, Stephen Spainhour, Pages: 737, Published: 2002
Visual Basic 2005 Express: Now Playing Authors: Wally Wang, Pages: 452, Published: 2005
Programming Windows 95: The Definitive Developer's Guide to Windows 95 API Authors: Charles Petzold, Pages: 1100, Published: 1996
TCL/TK in a Nutshell: A Desktop Quick Reference Authors: Paul Raines, Jeff Tranter, Pages: 440, Published: 1999
Special Edition Using Visual Basic .Net Authors: Brian Siler, Jeff Spotts, Safari Tech Books Online, Pages: 830, Published: 2002

Web:
how to read text current index a listbox - Developer Discussion Boards how to read text current index a listbox Symbian User Interface. ... (*itemArray )[iListBox->View()->CurrentItemIndex()]. you get text from current selected ...
Tk Built-In Commands - listbox manual page pathName see index: Adjust the view in the listbox so that the element ... the total width of the listbox text is off-screen to the left. fraction must be a ...
[Chapter 18] 18.10 The Listbox Widget Gets the index of the listbox item nearest to a given y coordinate. ... Manipulates the text in view. With no arguments, returns a list of two numbers ...
Getting the text of the currently selected list box item | NewLC I need to get the text of the currently selected list box item in a descruiptor. I know we can get the index of the current item selected as ...
Grid View Drop down list box selected index change event - ASP.NET ... Grid View Drop down list box selected index change event .... [Solved]Combo box and list box insert 'text' numbers (View topic ... Re: Combo box and list box insert 'text' numbers. Post by Villeroy on Tue Oct 21 , 2008 10:50 am. Let another cell do the convertsion ...
Listbox This is usually drawn with the text in grey. If the listbox is disabled, it does not respond to user .... Scrolls the list box view to the specified index. ...
ListBoxItem index or enumirating of ListBox Items over filtered ... how to read text current index a listbox - Page 2 - Developer ... how to read text current index a listbox Symbian User Interface. ... Originally Posted by masoud_bayat View Post. it write all in a line ...




Search This Site:










dnnstore forums problems help........

authentication tickets and session variables ?

upgrading from dnn 2.1.2 to dnn 3.0.5

starter kit if .net version 2.0

using a remote test server and not localhost

links_list page jumps to item's external link

hi - a sql security question - and a suggestion for f.a.q.

documents module tracking (?)

alignment of solpart menu

dnn 3.0.12 + htmlinputfile control

web service problems

theming for custom controls in asp.net 2.0

generation of designer file failed

unable to add buttons into a loginview

access to path denied, missing logconfig.xml.resources file

security with client-side callbacks

admin options to add/edit module and tabs at the top of the website appears when not logged in as admin/host

specified cast is not valid.

suggestion: webcast presentation when dnn 2.0 is released

can i change the name of a child portal?

bug: 3.0.6 - tabbing through user registration fields

masterpage ,asp.net 2.0

commercial portals derived from dnn

newbie: developing custom module and...

padnninstaller issue

server purposing webcast dec 7th

ionsimplechat

breadcrumb problem (2.1.2)

issue running aspnet_regsql successfully

requires sql, iis, .net framework but i have those already

 
All Times Are GMT