|
All of the solutions given to you will work, if you just want textbox controls on the "FORM".
But if your form contains tab-controls or frame-controls and you would like to know what/if these containers also contain textbox controls, then I think you need the solution I gave you.
Lastly, if you do not care about textbox controls nested inside tab pages that are not active you could use GetNextControl().
Here is an example.
public void SetFocusOnFirstEmptyControl()
{
int iCount=0;
System.Windows.Forms.Control Traverse = this;
//System.Reflection
while(Traverse != null)
{
Debug.WriteLine(++iCount + " " + Traverse.Text );
//myChild.GetType().BaseType.Equals(typeof(myFatherClass))
if(Traverse.GetType() == typeof(CheckBox) ||
Traverse.GetType().IsSubclassOf(typeof(CheckBox)))
{//do special case handling for check box
System.Windows.Forms.CheckBox pCheck = (System.Windows.Forms.CheckBox)Traverse;
if(pCheck.Checked== false)
{
Traverse.Focus();
break;
}
}
if(Traverse.Text.Length == 0)
{//test controls like textbox and dropdown
Traverse.Focus();
break;
}
Traverse = GetNextControl(Traverse, true);
}//while
}//SetFocusOnFirstEmptyControl
You have a lot of good people helping you. An answer is assured.
|
|
|
|
|
you're right, i really appreciate your help on this and i have learned a LOT of stuff from everyone helping and i thank you.
I got exactly what i needed and didn't even think about what you said regarding the textboxes on panels and tabs. i just thought it would show everything, but i was wrong.
Thanks very much for everyone's help.
.gonad.
|
|
|
|
|
Im using two listboxes and the second one fills upon SelectedIndexChanged from the first. when I set the datasource to either their respective SelectedIndexChanged event gets fired for each item that is contained in the listbox.
I was able to add all the items I need to the listbox via forloop and listbox.Items.Add, using a collection class for ValueMember and DisplayMember
but its pretty ugly compared to one line of code setting the datasource property.
is this supposed to happen when using the datasource property ?
----------this is what works:
public class Customer<br />
{<br />
public string CustomerDescription;<br />
public int CustomerID;<br />
public override string ToString()<br />
{<br />
return CustomerDescription;<br />
}<br />
}<br />
\\<br />
<br />
foreach(DataRow row in ds.Tables[0].Rows)<br />
{<br />
Customer newCustomer = new Customer();<br />
newCustomer.CustomerDescription = row["CustomerDesc"].ToString();<br />
newCustomer.CustomerID = System.Convert.ToInt32( row["CustomerID"] );<br />
lbCustomers.Items.Add( newCustomer );<br />
}
-- Kevin
|
|
|
|
|
I have a small problem here, but I am new to C# or .NET for that matter. I have a table row which I will put below, that needs to appear different when being viewed by Netscape. In IE it needs to display this:
Then in Netscape it needs to display this:
The only difference is, I took out the "Bookmark this page link" because it doesn't work in Netscape. Can anyone help me, I really need to get this working. Again this is a user control in C#. Thanks.
::C. VanDyke::
|
|
|
|
|
Hi...
I have written a proxy based web ad blocker in C#. The idea behind this is to route all HTTP traffic thru my program, so that banner ads can be blocked.
Browser's proxy settings are set to localhost and the port to the listening port, eg. localhost:8888
I am using a Tcplistener to listen to requests, and Httpwebrequest & webresponse to handle http traffic. everything seems fine. however, lately i notice that although the proxy is running, settings are correct, and browsers are configured to forward the requests to my proxy server, the requests are NOT sent to my proxy. I know this becoz i have a listview that will list all incoming traffic to the proxy, Browser windows just give me the "page cannot be displayed" message and the like.
At times after nemurous retries, the thing finnally worked and i can surf to almost anywhere with any browser. But when i shut down my proxy and load it again, i will get the same problem.
this proxy app is my degree project and it's gonna due in 14 days. i dunno wut's wrong. can some1 pls help me out?
|
|
|
|
|
How can I disable individual items in a CheckedListBox? I have a bit field in a db saying wether the item should be enabled/disabled and I want to make that item grayed out and not selectable.
Thanks.
Robert L. Edwards
|
|
|
|
|
you can access the individual checkboxes during the OnItemDataBound event.
|
|
|
|
|
I am looking for Cardinal Splines C# Implementation.
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
|
No! Let me say: I am looking for how cardinal spline formulas are implemented, I am looking for its source code.
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
|
Hi there !
I want to create a configurtion file, something like ProjectName.exe.config file, which will include XML elemnts that don't have "key" and "value".
For example:
<server id='BR.1.ET' address='127.0.0.1' dbg='true' maxClients='4' description='Server details'>
I want to read without going through all the nodes and attributes. Is there something similar to this method:
String dsn = ConfigurationSettings.AppSettings["pubs"];
?
Bye
|
|
|
|
|
nahumtakum wrote:
I want to read without going through all the nodes and attributes. Is there something similar to this method:
Well, you are going to have to write your own implementation of IConfigurationSectionHandler . Take a look at my article : An extension for a Configuration Settings class in .NET[^]
-Nick Parker
|
|
|
|
|
Hi Nick !
Can you please supply me the Test.exe.config file you are working with in your article ?
Thanks.
|
|
|
|
|
nahumtakum wrote:
Can you please supply me the Test.exe.config file you are working with in your article ?
I will soon be updating the article to identify this item and other issues that should make things more understandable. I need time which I am lacking at the moment.
-Nick Parker
|
|
|
|
|
Hello,
I have a problem with remoting. In my remoting component I have a custom defined exception handling class. This class derives from the ApplicationException class. Now i need to send my custom exception to the client via remoting. As i have already inherited the ApplicationException class i cannot inherit the marshalbyrefobject which is required for remoting.
So how can i send my custome exception object to the client via remoting?
I have tried sending the exception object by using another class which inherits remoting and then creates an instance of the custom exception class. Still it throws some errors (remoting based or serialization based). If I try to use the [serializable] attribute it throws a deserialization error when I run the application.
Please Please help as my work is stuck unless i solve this one. 
|
|
|
|
|
Hi guys,
we developed a object persistent framework for .net and posted it at sourceforge as GPL (Url: http://www.sourceforge.net/projects/opfnet/). I don't know if somebody out there wants to check out our library in his own applications. You are welcome to use it in your open source projects and to give us a feedback - if you want!
We posted also a tutorial on the page. As it is not so easy to understand a thing never used before without tutorial.
Perhaps somebody likes it. It would be cool to get feedbacks.
Thanks and bye bye.
Christian
ps.
codeproject - i like it! i guess the best page for .net sources thanks a lot to the authors of the articles on this page. They ARE very helpful!
________
love your code and code your love 
|
|
|
|
|
what about publishing an article about it here in codeguru?
eperales
|
|
|
|
|
That would be a great idea! I guess I'm gonna do it...
I have only to check first - how to do it...
Christian
|
|
|
|
|
I want to print all files of a directory in a single click(Print Command).Files are of diffent formats(egs..,.txt,.pdf,.doc).Is it possible to do so..?Kindly Respond
Thanks in Advance..
V.Pillai
|
|
|
|
|
I 've create satelite assmebly for my applicartion.I use this line of code to set the CurrentUICulture:
Thread.CurrentThread.CurrentUICulture = new CultureInfo("fa-IR");
But I have to only plcae it befire InitializeCommponet() in the cunstructor of Form.I want to do it in other plcae too,for examkpe user select a language from a combobox. Is that possible?
Mazy
No sig. available now.
|
|
|
|
|
I have a weird problem to solve -- is there a way to turn an already compiled MDI application into SDI. It doesn't have to be a perfect solution -- it can be a manual process. For example, if I can get a list of MDI child winodws in the MDI, then have a button for me to manually make a MDI child window into a SDI window, that will be enough for me.
Any help will be greatly appreciated.
Kam
|
|
|
|
|
I think you can simply set the MDIParent property of each child window to null at runtime:
foreach(Form f in this.MdiChildren)
{
f.MdiParent = null;
}
|
|
|
|
|
Hi. I am transferring an XML file to another PC's shared folder. I tried to use a File.Copy method but the XML file that has been transferred to the other pc becomes garbage. Is there another way of transferring the file that it won't become garbage?
I used the ff code:
File.Copy("\\\Data\\" + FileName, true);
Where Data is a shared folder. The file got there alright but the content is just garbage. Please help.
"To teach is to learn twice"
|
|
|
|
|
I would suspect that something else is going on since that code should work. It's not as if the operating system treats XML files differently than other files when copying them. I'd play around a little to try and discover what's occurring.
Cheers, Julian
Program Manager, C#
This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
|
|