i am using .NET CF making application in window mobile.
need want to add textboc in third column of listview.
googled it but only getting solution for web application.
aint it possible in window mobile ????
code i tried so far... (although it is not working :-) )
for (int i = 0; i < soups.Length; i++)
{
ListViewItem li = new ListViewItem();
li.Text = "RSO" + (i+1);
li.SubItems.Add(arrval[i]);
//in 1st attemp i tried
li.SubItems.Add(new TextBox());
//in 2nd attemped
TextBox tbox = new TextBox();
li.SubItems.Add(tbox);
li.SubItems.Add(Convert.ToString(5 * (i + 1)));
li.SubItems.Add(Convert.ToString(35 * (i + 1)));
lst_option.Items.Add(li);
}
but both ways not working.... bcz of obvious reasons as i am trying to add obj in add() method instead of string :) :)
thnkx in advance
None of the out-of-the-box controls for the Compact Framework (ListView, ListBox, DataGrid, etc) provide this capability. The common work-around is to place a separate TextBox on the form and when a ListViewItem is selected, move the Textbox to cover the location of the subitem/cell, put the subitem/cell text into the TextBox, then make it visible.
Related
I have several System.Windows.Forms.Combobox whose dropdowns close when I click on the scrollbar. I can use the arrow to scroll to the bottom, then it allows me to click and drag the scrollbar. The dropdown also disappears sometimes when I click between the bar and the arrows, although sometimes it doesn't. I've tried changing a lot of parameters but to no avail. Scrolling with the mouse wheel works perfectly. This seems like a bug, has anyone come across it?
I have turned off all event handlers for the combobox and it still shows the same behaviour.
This is the Designer code for the combobox (cmbSubmit):
this.cmbSubmit.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbSubmit.DropDownWidth = 620;
this.cmbSubmit.FormattingEnabled = true;
this.cmbSubmit.Location = new System.Drawing.Point(6, 30);
this.cmbSubmit.Name = "cmbSubmit";
this.cmbSubmit.Size = new System.Drawing.Size(620, 33);
this.cmbSubmit.TabIndex = 0;
And the code where I add items to the combobox:
cmbSubmit.Items.Clear();
for (int i = 0; i < 100/*numItems*/; i++)
{
cmbSubmit.Items.Add("" + i);
}
Any help would be greatly appreciated, thanks in advance.
Good day all.
I have an issue with using the ListView control in C#:
I can create an Object of it and at least from what the debugger says (nothing) I can also add items and columns and all. However:
I cannot see the ListView at all.
Below the code with which I want to draw it onto an otherwise emtpy Form:
private ListView auftraegeView;
And then inside the constructor, after InitializeComponent:
auftraegeView = new ListView();
auftraegeView.View = View.Details;
auftraegeView.Width = this.Width - 12;
auftraegeView.Height = this.Height - 20;
auftraegeView.Left = 6;
auftraegeView.Top = 14;
I tried .Show() and .Refresh() methods, but to no avail.
The problem is that you are not adding your control to your form. You have created the object but now you need to show it on the form. For that you have to add it to the list of controls that need to be shown on the forms.
Some thing like
yourFormName.Controls.Add(auftraegeView );
Have tyou tried BringToFront and checked that the prorperties Visible = true?
i Now is trivial but..
I am programmatically creating a taskbar notify icon and Right Click ContextMenu in a C# WPF application.
A couple of the ContextMenu items have submenus whicr are populated from webservice calls. One of these is can span the entire height of the users screen, because it is over 100 entries, and you get the overflow arrows. I would like to be able to set max height to like 500.
I have been unable to figure out how to limit the size of these ContextMenu submenus programmatically. Below is the code I used to create the "Directory" submenu, which in theory can contain 0 to 1,000 entries.
Is it possible?
Any help is appreciated, Thank you.
m_menu = new System.Windows.Forms.ContextMenu();
System.Windows.Forms.MenuItem newMenuItem4 = new System.Windows.Forms.MenuItem("Directory");
System.Windows.Forms.MenuItem newExistMenuItem4 = (System.Windows.Forms.MenuItem)this.m_menu.MenuItems[0];
if (numbers.Count > 0)
{
int indx = 0;
foreach (string number in getContactDirectory() )
{
newMenuItem4.MenuItems.Add(indx,
new System.Windows.Forms.MenuItem(number, new System.EventHandler(historyCall)));
indx++;
}
m_menu.MenuItems.Add(menuCounter, newMenuItem4);
menuCounter++;
}
You need to familiarize yourself with Control templates and XAML.
Have a look at the blog - http://xcalibur37.wordpress.com/2013/05/09/an-enhanced-menuitem-to-limit-submenu-height/
This should answer yoour question - Best way to set a MenuItem's sub-menu height?
So, in a new form I create programmatically some labels and linklabels.
The number is NOT known by the start of the program. And I need to display them in a container or something, and when they are too many, the container should display a vertical scrollbar..
My Form is must have a fixed size
I tried Panel, LinkLabel but no success, meaning it doesn't show a scrollbar and some of the controls don't show up
Do you have any ideas?
(I want to make something like a table of contents, but which doesn't have a fixed number of items)
Thank you...
Some code:
for(int i=0; i<number ;i++)
{
Label l=new Label();
l.Name = i + ".label";
this.Controls.Add(l); // need to replace "this" with name of a control
l.Location(50, i * 20 + 50);
}
I solved this by using a Panel, and setting its AutoScroll property to TRUE. Now it works.
I get this response from a web service call. Something like this
<Response>
<Control1 type = "DropdownList" value= "USA,UK,Sweden,UAE"/>
<Control2 type = "Textbox" value= "Contries"/>
<Control3 type = "Button" value= "None">
</Response>
Based on this I de-serialize it into List<Controls>.
Now I need to be able to dynamically create a winform based on these controls. My problem is the layout. I want to be able to create them nicely separated (If possible vertically aligned) in batches of lets say 5.So If I need 15 controls I have 3 columns and 5 rows.
What would be best way to achieve this? I know that I can use the inbuilt positioning properties like top, width etc., but maybe someone out there has done something similar in a better way.
I think you should use TableLayoutPanel. Also you can read best practices to use this control.
One benefit of using TableLayoutPanel from above article:
Layouts that will be modified or generated dynamically at run time, such as data entry forms that have user-customizable fields added or subtracted based on preferences.
So basically I am gonna do something like this(might be useful for someone else)
Form op = new Form();
FlowLayoutPanel panel = new FlowLayoutPanel();
op.Controls.Add(panel);
for (int i = 0; i < 10; i++)
{
Button b = new Button();
b.Text = "Button" + i.ToString();
panel.Controls.Add(b);
}