|
hi ,
I used a listbox for going to the next or previous record .For the savebutton event , I wrote this :
private void btnSave_Click(object sender, EventArgs e)<br />
{<br />
...<br />
PopulateListBox1();<br />
}
and For the PopulateListBox1() Function :
private void PopulateListBox1()<br />
{<br />
...<br />
if (ListBox1.Items.Count > 0)<br />
{<br />
ListBox1.SetSelected(ListBox1.Items.Count - 1, true);<br />
}<br />
...<br />
}<br />
thus , the last record is selected .If I want to select the current record when I press the savebutton , How can I do it ?
thanx
s_mostafa_h
-- modified at 2:17 Thursday 20th July, 2006
|
|
|
|
|
You can find the value or text in the list first and then made that selected.
Best Regards,
Apurva Kaushal
|
|
|
|
|
can u more explain ?
thanx a lot ,
s_mostafa_h
|
|
|
|
|
Sorry for the confusion, actually i got confused with dropdwon list control.
Cant you do something like this.
string str = "sometext";<br />
for(int i=0;i<=listBox1.Items.Count; i++)<br />
{<br />
if(listBox1.Items[i].Equals(str))<br />
{<br />
listBox1.SetSelected(i,true);<br />
}<br />
<br />
}
Best Regards,
Apurva Kaushal
|
|
|
|
|
apurva kaushal wrote: Cant you do something like this.
string str = "sometext";
"sometext" must be "ListBox1.Value" , but i recieve a "assigned local variable " Error .
REGARDS ,
s_mostafa_h
|
|
|
|
|
No sometext is the text what you need to be set as selected in the listbox.
Best Regards,
Apurva Kaushal
|
|
|
|
|
the Items'ListBox1 (e.g. field [name of company])are the same that with the selection of them , I can go to any record of the Table(next or before record ).
apurva kaushal wrote: sometext is the text what you need to be set as selected in the listbox.
Which Text ?
Regards ,
s_mostafa_h
|
|
|
|
|
Hi,
What i am trying to say is suppose you are having 3 items in your listbox i.e "abc", "mno" and "xyz". And you want to make "mno" as your selected item then what you need to do is put "mno" in place of "sometext". And you are done.
Best Regards,
Apurva Kaushal
|
|
|
|
|
thanks !
regards ,
s_mostafa_h
|
|
|
|
|
always welcome
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hello,
in a program i'm writing I need to get a list with the accounts on my computer. (This must be shown in a combobox, but that's a detail). If I select an account I should need to convert them into a WindowsIdentity object. With that object, I then check file access rights...
Kind regards,
Frederik
|
|
|
|
|
What exactly is your problem, getting the accounts or converting them to WindowsIdentity objects?
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
Actually both, for now i don't know how to get the users so in mean while i just tested with filling in the username in a textbox. Then i tried to get a windowsIdentity object from that but it failed. The only thing i can do is get the SID from the username.
I want to have a WindowsIdentity object to use in this class: www.codeproject.com/useritems/UserFileAccessRights.asp
So if you could tell me how to get from sid to windowsIdentity or to get a list with users and windowsIdentity objects, it's the same...
Greetz,
Frederik
|
|
|
|
|
There is probably something you could use in System.DirectoryServices.dll . Regarding the second issue I'm sorry but I don't have time at the moment to even scan the article, but hopefully the DirectoryServices namespace might help you a bit.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
Can anybody help me in disabling the pop up menu ie . (paste, cut, copy etc) thanx
Akhil
|
|
|
|
|
akhils wrote: Can anybody help me in disabling the pop up menu ie . (paste, cut, copy etc)
Why do you want to do that? Can you elaborate in more detail and maybe someone can help?
|
|
|
|
|
hi... thnx for the response
in my Application i hav a combo box . i dont want user to enter the values which are not there in the list . so i suppressed the key events . now user is not able to enter the values through key board. But the problem is user is able to right click on it and and cut the values, paste the values etc . can u help me in this problem ???
Akhil
|
|
|
|
|
You might want to look at this article, A Complete Read Only ComboBox[^]
Or search this site for read only comboboxes. This might help you and you won't have to worry about trapping mouse events.
Hope this helps some,
Paul
|
|
|
|
|
Hello my friend,
Just check "DropDownStyle" property of combobox.
Set the property to DropDownList.
Rahul Kulkarni
|
|
|
|
|
RahulRKulkarni wrote: Set the property to DropDownList.
That looks like it works just fine
|
|
|
|
|
Thanx All for the replies.. let me try it out
Akhil
|
|
|
|
|
akhils wrote: Thanx All for the replies.. let me try it out
Good luck to you
|
|
|
|
|
Hi All, I am trying to figure out how to use a VScrollBar within a Panel and a series of textboxs. I have about 25 textbox within a Panel. I want to be able to scroll through the panel if the form is to small to see all the textbox. I tried putting a VScrollBar within the Panel but can't get it to scroll the contents of the panel. I can't use AutoScroll property coz I'm developing for Pocket PC. Dot Net Portal Framework don't have autoscroll property for panel. Can you please tell me how am I gonna change the panel visible area.
Thanks
|
|
|
|
|
Hi guys,
In C# how do I check if a table exists on SQL server 2000? If it doesn't exists then I am creating the tables but I would like to check first if the table exists.
Please help.
sasa
|
|
|
|
|
an easy way would be to use a try and catch and create the table. SQL wont overwrite the table thus if it exist your program will throw the exception which will be caught. Or you could use the following T-SQL
IF (SELECT count(name) FROM sysobjects WHERE type = 'U' and name = 'yourtable') > 0
BEGIN
Print 'Table Exists!!'
END
else Print 'Table Does not Exist!!'
|
|
|
|