Home All Groups Group Topic Archive Search About
Author
2 Mar 2006 1:41 PM
elwaly
hi there
any one to tell me how to change a textbox font at run time
perminantlly so that the user  can set the textbox's font one time and
rerun the application without change in the font he set (the user set
the textbox's font as his default font) assuming that the application
uses the microsoft's common  font dialog box and the textbox is indexed
in an array
thank you

Author
2 Mar 2006 3:10 PM
Herfried K. Wagner [MVP]
"elwaly" <elmoizw***@mobifree.net> schrieb:
> any one to tell me how to change a textbox font at run time
> perminantlly so that the user  can set the textbox's font one time and
> rerun the application without change in the font he set (the user set
> the textbox's font as his default font) assuming that the application
> uses the microsoft's common  font dialog box and the textbox is indexed
> in an array

If you are using .NET 2.0:

Add a label onto the form.  Then add a fontdialog component and a button
control.  Place the code below in the button's 'Click' event handler:

\\\
If Me.FontDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
    Me.Label1.Font = Me.FontDialog1.Font
End If
///

In the design view, select the label control and choose
'(ApplicationSettings)' from the "Data" section".  Choose
'(PropertyBinding)' there and press the "..." button.  Then select the
'Font' property in the application settings dialog and add an application
setting by selecting "New..." from the combobox on the right side of the
'Font' property in the grid.  No additional code is required.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
4 Mar 2006 12:15 PM
elwaly
thank you very much Herfried,
that code is exactlly what I am looking for.
thanks again.