I did it, here the code  for the form in the TabPage

Form1 _ff= new Form1();
_ff.TopLevel= false;
_ff.FormBorderStyle=FormBorderStyle.None;
TabPage _tabpage = new TabPage("Caption here ");
_tabPage.Controls.Add(_ff);
TabControl1.Controls.Add(_tabPage);
_ff.Show();


Thanks Wyrm and other collegues as well.



On Mon, Aug 24, 2009 at 8:41 PM, Mohammed Hussain
<[email protected]>wrote:

> Brother I tried this but the exception is 'invalid index value occurs'
> What i did it in my code is as follows:
>
> frmMasterGrid  _Master= new frmMasterGrid();
> TabControl.TabPages[0].Controls.Add(_Master);
>
> Now I change my code as follows and works fine for controls, here is:
> TextBox  _Master= new TextBox;
> TabControl.TabPages[0].Controls.Add(_Master);
>  works fine....
>
> My requirement is not fulfilled so i change the code by using the
> link......
>
> *http://bytes.com/topic/net/answers/515603-load-form-tab-control-page*
>
> I further explore the thing...
>
> if you find it much better thing.. then reply me
> Thanks
>
>
>
> On Mon, Aug 24, 2009 at 4:45 PM, Wyrm <[email protected]> wrote:
>
>>
>> Hello!
>> I can see two problems on the line that throws an error.
>> - you don't say which TabPage gets a new control. (=>
>> TabControl.TabPages(index).Controls.Add();)
>> - you don't say which control you add to your TabPage (=>
>> TabControl.TabPages(index).Controls.Add(something))
>> Maybe your code here isn't what you have in your application, but
>> right now these two strike me as quite easy to correct.
>>
>> On 24 août, 12:18, "Mohammed.hussain" <[email protected]> wrote:
>> > Q) How to Add a form on TabPage?
>> >
>> > How i do this...
>> > frmMaster _frm = new frmMaster();
>> > TabControl.TabPages.Controls.add();   // error occurs
>> >
>> > bla bla bl...........
>> >
>> > frmMaster contains the DataGridView and The navigaion code
>> > From the menu Selection the TabPage call and it contains the frmMaster
>> > grid..
>> >
>> > How i Call the form into the TabPage..
>> >
>> > Thanks
>>
>
>
>
> --
> Regards,
> Muhammad hussain
>



-- 
Regards,
Muhammad hussain

Reply via email to