472,796 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,796 software developers and data experts.

Multiselect on page load..? how to solve this..?


Hi groups,

Control name : ListboxID (lstCertification), selection mode=mutliselect.

On Pageload i'm assinging string lstSplit="1/3/6/8" of the previously selected listindex id's. Now on the page load for updation, i have to reload the selected items again with the same string "1/3/6/8" to be selected in my multiselect list box.
Its asking me to convert object to int... for list selection. but how to achieve this..?
--------------------------------------

string[] result;

string lstSplit;

lstSplit = "1/3/7/8";

char[] sep = { '/' };

Array a = lstSplit.Split(sep);

for (int i = 0; i < a.Length; i++)

{

lstCertification.SelectedIndex = a.GetValue(i) ; << -------------- casting from Obj to Int..??

lstCertification.SelectedItem.Selected = true;

}

---------------------------------------

I want to multiselect my listbox on page load with the string value stored in Database "1/3/5/6/8" etc to listbox mulitselection iindex..? is there any other way to solve this..???

Mahesh

Nov 19 '05 #1
6 1657
Hi Mahesh,

In the loop, you can do the following

for(....)
{
int i = (int)a[i];
lstCertification.Items[i].selected = true;
}

HTH
Kalpesh

Nov 19 '05 #2
not working..

-------------------

string lstSplit;

lstSplit = rdrExmr["airman_cert_held"].ToString(); < ----------
{ 1/3/4/5/6/ } returns

char[] sep = { '/' };

Array a = lstSplit.Split(sep);

for (int i = 0; i < a.Length; i++)

{

int ij = (int)a[i]; /// giving error here....

lstCertification.Items[i].Selected = true;

}

-------------------

error messa-ge : Cannot apply indexing with [] to an expression of type
'System.Array'

Mahes
"Kalpesh" <sh*********@gmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
Hi Mahesh,

In the loop, you can do the following

for(....)
{
int i = (int)a[i];
lstCertification.Items[i].selected = true;
}

HTH
Kalpesh

Nov 19 '05 #3
Hi Mahesh,

Change the line to
int ij = (int)a.GetValue(i);

HTH
Kalpesh

Nov 19 '05 #4
Hi mahesh,
did u try with this code..
its working from my side..

lst.SelectedIndex =
lst.Items.IndexOf(lst.Items.FindByText(@"1/1/2004"));

Bye,
Praveen P.
¿ Mahesh Kumar wrote:
Hi groups,

Control name : ListboxID (lstCertification), selection mode=mutliselect.

On Pageload i'm assinging string lstSplit="1/3/6/8" of the previously selected listindex id's. Now on the page load for updation, i have to reloadthe selected items again with the same string "1/3/6/8" to be selected in my multiselect list box.
Its asking me to convert object to int... for list selection. but how to achieve this..?
--------------------------------------

string[] result;

string lstSplit;

lstSplit = "1/3/7/8";

char[] sep = { '/' };

Array a = lstSplit.Split(sep);

for (int i = 0; i < a.Length; i++)

{

lstCertification.SelectedIndex = a.GetValue(i) ; << -------------- casting from Obj to Int..??

lstCertification.SelectedItem.Selected = true;

}

---------------------------------------

I want to multiselect my listbox on page load with the string value stored in Database "1/3/5/6/8" etc to listbox mulitselection iindex..? is there any other way to solve this..???



Mahesh


Nov 19 '05 #5
int ij = (int)a.GetValue(i); --> Specified cast is not valid.

Mahesh

"Kalpesh" <sh*********@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Hi Mahesh,

Change the line to
int ij = (int)a.GetValue(i);

HTH
Kalpesh

Nov 19 '05 #6
Hi Mahesh,

If you are storing int in the Array, then it should work

Try this
int ij = (int)(a.GetValue(i));

HTH
Kalpesh

Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: David Given | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Say I have a piece of Javascript that transforms the HTML on a page. (In order to work around CSS bugs.) I could invoke this from the BODY onload...
2
by: Alan Lane | last post by:
Hello world: I'm using Access 2003. I have 2 listboxes. One is a single column. The other has two columns. I can use Dev Ashish's code (thanks Dev!) from the Access MVP Website to accumulate...
1
by: tod4 | last post by:
Hi, My problem: I have query with value klient and product. On my form Im using multiselect box as filter of klient value. Now I would like to use second multiselect on this form for product...
2
by: Steph | last post by:
I have created a multiselect list box control (lbx_comorb) that is populated from a datatable (dt_ptAdmission). The list box populates now problem at all. However the issue is when I load the...
1
by: Clayton Hoyt | last post by:
Hi Folks...this is a wierd issue I've noticed and wanted to know of a) anyone else has noticed this and b) if so, why does it happen. On page load, I have a text box named me.txtMemberName. I...
3
by: kaosyeti via AccessMonster.com | last post by:
hey... i have an unbound multiselect listbox on a form that i want to use to populate text boxes on that form. so if a user selects the 3rd item in a list of 20, how can i have that item show up...
43
by: Dan2kx | last post by:
Hello AGAIN 'Nother problem to solve.... im trying to set the MultiSelect property within VB for a list box, and i am using the code Me.StaffHols.Multiselect = True and it wont work, it...
5
by: erbrose | last post by:
Hey all, newbie to vb here. I've created a listbox (called lst_county) that gets populated from a Select * From Table in Oracle on load. I've set the MultiSelect to 2 -Extended. I've got some code...
1
by: hemantkamb | last post by:
Hi…. I have created one website with Master and content page . I have taken TreeView Control on master page. And I wants that when I click to tree node the value of tree node is added to...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.