473,401 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Tab control problem

Hi,

I have a combobox on a tab control the 2nd tab that does
not behave properly.

When I try to set the selectedindex by iterating
the items collection I get cmb.Items.Count = 0.
This is a custom funciotn to set the index
from a value code is below.
But if i put the same combobox directly on the form
it works fine.

Any ideas????

rotsey

public void FindByValue(string value, string columnname)

{

int aIndex;

DataRowView drv;

if (this.Name == "PayFrequency")

Console.WriteLine("");

ComboDebug.Instance.list.Add(this.Name + " ---- NumItems: " +
this.Items.Count);

for (aIndex = 0; aIndex < this.Items.Count; aIndex += 1)

{

try

{

drv = (DataRowView)this.Items[aIndex];

if (drv.Row[columnname].ToString() == value)

{

this.SelectedIndex = aIndex;

return;

}

}

catch (Exception)

{

if(this.Items[aIndex].ToString() == value)

{

this.SelectedIndex = aIndex;

return;

}

}

}

this.SelectedIndex = -1;

return;

//throw new Exception("Could not find value '" + value + "' in combobox " +
this.Name);

}
Jun 28 '07 #1
1 1256
Well I could not find an answer must be a bug.

so instead I had to implement my own tab control using
panels and buttons and it works great.

That damn m_______t

"Rotsey" <ma***********@RemoveThis.optusnet.com.auwrote in message
news:e$*************@TK2MSFTNGP06.phx.gbl...
Hi,

I have a combobox on a tab control the 2nd tab that does
not behave properly.

When I try to set the selectedindex by iterating
the items collection I get cmb.Items.Count = 0.
This is a custom funciotn to set the index
from a value code is below.
But if i put the same combobox directly on the form
it works fine.

Any ideas????

rotsey

public void FindByValue(string value, string columnname)

{

int aIndex;

DataRowView drv;

if (this.Name == "PayFrequency")

Console.WriteLine("");

ComboDebug.Instance.list.Add(this.Name + " ---- NumItems: " +
this.Items.Count);

for (aIndex = 0; aIndex < this.Items.Count; aIndex += 1)

{

try

{

drv = (DataRowView)this.Items[aIndex];

if (drv.Row[columnname].ToString() == value)

{

this.SelectedIndex = aIndex;

return;

}

}

catch (Exception)

{

if(this.Items[aIndex].ToString() == value)

{

this.SelectedIndex = aIndex;

return;

}

}

}

this.SelectedIndex = -1;

return;

//throw new Exception("Could not find value '" + value + "' in combobox "
+ this.Name);

}


Jun 28 '07 #2

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

Similar topics

11
by: Sagaert Johan | last post by:
I have made a custom control that draws a rectangle when the mouse is down, and does nothing when the mouse is up. I set/reset a flag in MouseDown/Mouse up and use this to do the drawing in the...
11
by: Brian W | last post by:
Yet another editor problem To reproduce do the following 1) Open a Webform and switch to HTML edit mode 2) Enter the Following (include spaces) This is some text before <asp:hyperlink...
3
by: Eric | last post by:
I have built a composite user web control that I want to create dynamically. The form will contain a variable number of these controls and as well some of the contents of the user web control...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
7
by: Chuck Hartman | last post by:
I have a Windows service that requests web pages from a site using an HttpWebRequest object. When I try to request a page from an ASP.NET 2 site, I get a WebException with message "The remote...
5
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in...
4
by: Tony Johansson | last post by:
Hello! I have one solution file that consist of three project. One project that build the exe file called A One project that build a user control dll. Here we have a class called B One project...
5
by: tony | last post by:
Hello! This is a rather long mail but it's a very interesting one. I hope you read it. I have tried several times to get an answer to this mail but I have not get any answer saying something...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.