Click here to Skip to main content
15,899,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to show a textbox after the last item in a list view if count of item is not zero. But if zero, textbox must be shown on top.

I tried with setting location of textbox by

C#
TextBox1.location=new point(0,listviewStaticVar.items.count+1);


But I am missing something to setting location pls help.


Thank you.
Posted
Updated 27-May-13 1:47am
v2
Comments
lukeer 27-May-13 7:49am    
0) Wrap code between tags like these: <pre lang="c#">YourCodeHere();</pre> (FTFY).
1) One full stop suffices per sentence.
Anjanee Kumar Singh 27-May-13 7:50am    
ok

1 solution

The y-component of TextBox1.Location should be the product of a ListView.Items.Count[^] and the height of one of the items in pixels. You can use ListViewItem.Bounds[^] for that.
Just check if there are any items, and use an y-component of zero if not.
 
Share this answer
 
v2
Comments
Anjanee Kumar Singh 27-May-13 7:54am    
can i get the code so that i can understand better...

Thank you
Anjanee Kumar Singh 27-May-13 8:06am    
I did It Like This.............

txtDevTr.Visible = true;
Rectangle r = new Rectangle(position, lvItem.Bounds.Top, end, lvItem.Bounds.Bottom);
txtDevTr.Location = new Point(position - 1,listViewStaticVar.Items.Count+1);
txtDevTr.Show();
lukeer 27-May-13 8:45am    
And did it work?
What is position?
What do you use r for?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900