Custom control in ToolBar

  • Thread starter Thread starter Leon Chi
  • Start date Start date
L

Leon Chi

As the title, How to change a ToolBarButton on a ToolBar to a custom
control? For example. change a ToolBarButton to a ComboBox?
 
same way you add controls to other controls
for the toolbar, you would find the index representing the target cell
control and just use the add function passing in the control you want to
add.
 
Thanks for your reply. But I didn't understand you clearly.
If I use ToolBar.Controls.Add(), I can add a control to the ToolBar.
but the layout it isn't what I expected. Because I want to replace
a ToolBarButton. Can you give me a simple sample code? Thanks


Alvin Bruney said:
same way you add controls to other controls
for the toolbar, you would find the index representing the target cell
control and just use the add function passing in the control you want to
add.


--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Leon Chi said:
As the title, How to change a ToolBarButton on a ToolBar to a custom
control? For example. change a ToolBarButton to a ComboBox?
 
right, so you need to remove a button first
toolbar.cells[x].remove() and then add.
sorry, my VS studio took a crap and i am re-installing. maybe tonight i can
find the code and post it

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Leon Chi said:
Thanks for your reply. But I didn't understand you clearly.
If I use ToolBar.Controls.Add(), I can add a control to the ToolBar.
but the layout it isn't what I expected. Because I want to replace
a ToolBarButton. Can you give me a simple sample code? Thanks


Alvin Bruney said:
same way you add controls to other controls
for the toolbar, you would find the index representing the target cell
control and just use the add function passing in the control you want to
add.


--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Leon Chi said:
As the title, How to change a ToolBarButton on a ToolBar to a custom
control? For example. change a ToolBarButton to a ComboBox?
 
Thanks for your warmhearted!

I look up in the MSDN. ToolBar control seems have not a property called
"Cells".
Confusing. Waiting for your reply! Thanks again.


Your Sincerely
Leon


Alvin Bruney said:
right, so you need to remove a button first
toolbar.cells[x].remove() and then add.
sorry, my VS studio took a crap and i am re-installing. maybe tonight i can
find the code and post it

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Leon Chi said:
Thanks for your reply. But I didn't understand you clearly.
If I use ToolBar.Controls.Add(), I can add a control to the ToolBar.
but the layout it isn't what I expected. Because I want to replace
a ToolBarButton. Can you give me a simple sample code? Thanks


Alvin Bruney said:
same way you add controls to other controls
for the toolbar, you would find the index representing the target cell
control and just use the add function passing in the control you want to
add.


--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
As the title, How to change a ToolBarButton on a ToolBar to a custom
control? For example. change a ToolBarButton to a ComboBox?
 
Back
Top