GetNextControl

  • Thread starter Thread starter Alfred Gary Myers Jr.
  • Start date Start date
A

Alfred Gary Myers Jr.

Hi,

Is there any way I could get the functionality of
System.Windows.Forms.Control.GetNextControl in the Compact Framework?

Thanks in advance

Alfred Gary Myers Jr.
Yuma Informática Ltda.
 
The tab order of the controls in CF will correspond the order of the
controls in the Form.Controls collection, so the implementation of would
look something like this:

public Control GetNextControl(Control ctl, bool forward)
{
int currIndex = this.Controls.IndexOf(ctl);

if (forward)
{
//check if it's the last control in the collection
if (currIndex < this.Controls.Count)
currIndex++;
else
currIndex = 0; //move to the first one
}
else //backwards
{
//check if it's the first control in the collection
if (currIndex > 0)
currIndex--;
else
currIndex = this.Controls.Count - 1; //move to the last one
}
return this.Controls[currIndex];
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top