Hey all!
Using VB.Net... How can I save the font properties of a textbox to an ASCII
file and later read the file and apply the properties back to the textbox?
Users use multiple workstations, so I need to save the info into an INI file
as the registry does not move with the users. Also, the settings will not be
saved in the same location as the program itself, so configuration files
will not work. I need to save the users text preferences and cannot see a
way to do this in VB.Net.
Thanks! 9 2015
Hello,
"RooLoo" <Ro****@Loo.Roo> schrieb: Using VB.Net... How can I save the font properties of a textbox to an ASCII file and later read the file and apply the properties back to the textbox?
Write a class that contains a property of type font and serialize it.
Basic sample: http://www.mvps.org/dotnet/dotnet/samples/miscsamples/
-> sample "XmlSerialization"
Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET http://www.mvps.org/dotnet
You are kidding, right?
As I described... I cannot use the serialization as the file is stored on a
network folder, not with the application.
There MUST be some way to extract the font.bold, font.name, etc. values and
then reapply them later.
"Herfried K. Wagner" <hi*******@m.activevb.de> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl... Hello,
"RooLoo" <Ro****@Loo.Roo> schrieb: Using VB.Net... How can I save the font properties of a textbox to an ASCII file and later read the file and apply the properties back to the textbox?
Write a class that contains a property of type font and serialize it.
Basic sample:
http://www.mvps.org/dotnet/dotnet/samples/miscsamples/ -> sample "XmlSerialization"
Regards, Herfried K. Wagner -- MVP · VB Classic, VB .NET http://www.mvps.org/dotnet
But why do I need to create a new font object when the textbox already
has a perfectly good font property to manipulate???
"Herfried K. Wagner" <hi*******@m.activevb.de> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... Hello,
"RooLoo" <Ro****@Loo.Roo> schrieb: As I described... I cannot use the serialization as the file is stored on a network folder, not with the application. I didn't test it but isn't it possible to deserialize files on a
network folder?!
There MUST be some way to extract the font.bold, font.name, etc. values and then reapply them later. You can extract them "by hand" depending on the format you used to
save the data and create a new Font object:
http://msdn.microsoft.com/library/en...sctortopic.asp Regards, Herfried K. Wagner -- MVP · VB Classic, VB .NET http://www.mvps.org/dotnet
"Some One" <po********@127.0.0.1> schrieb But why do I need to create a new font object when the textbox already has a perfectly good font property to manipulate???
Problaby because in Windows, you can't change a font after creation. I'm not
sure, so have a look at
MSDN
graphics and multimedia
Windows-GDI
SDK documentation
Windows GDI
Fonts and Text
--
Armin
Hello,
"Armin Zingler" <az*******@freenet.de> schrieb: Problaby because in Windows, you can't change a font after creation. I'm not sure, so have a look at
AFAIK you are right.
Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET http://www.mvps.org/dotnet
I'm really trying to get this to work with only partial success...
My line of code looks like this (pardon the wrapping):
txtPad.Font = New System.Drawing.Font(iniFile.getValue("FontFace",
"Arial"), Val(iniFile.getValue("FontSize", "10")))
where iniFile.getValue returns a STRING from a file. (
iniFile.getValue(strKey, strDefault) )
The above line of code works, BUT it does not apply any STYLE to the font. I
have not found a way to store the font style to a file and then be able to
recover and reapply it.
"RooLoo" <Ro****@Loo.Roo> wrote in message
news:eW**************@tk2msftngp13.phx.gbl... Hey all!
Using VB.Net... How can I save the font properties of a textbox to an
ASCII file and later read the file and apply the properties back to the textbox?
Users use multiple workstations, so I need to save the info into an INI
file as the registry does not move with the users. Also, the settings will not
be saved in the same location as the program itself, so configuration files will not work. I need to save the users text preferences and cannot see a way to do this in VB.Net.
Thanks!
Hello,
"RooLoo" <Ro****@Loo.Roo> schrieb: My line of code looks like this (pardon the wrapping): txtPad.Font = New System.Drawing.Font(iniFile.getValue("FontFace", "Arial"), Val(iniFile.getValue("FontSize", "10")))
where iniFile.getValue returns a STRING from a file. ( iniFile.getValue(strKey, strDefault) )
The above line of code works, BUT it does not apply any STYLE to the font. I have not found a way to store the font style to a file and then be able to recover and reapply it.
Convert the font style to an integer and save/load it.
Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET http://www.mvps.org/dotnet
> > My line of code looks like this (pardon the wrapping): txtPad.Font = New
System.Drawing.Font(iniFile.getValue("FontFace", "Arial"), Val(iniFile.getValue("FontSize", "10")))
where iniFile.getValue returns a STRING from a file. ( iniFile.getValue(strKey, strDefault) )
The above line of code works, BUT it does not apply any STYLE to the font. I have not found a way to store the font style to a file and then be able to recover and reapply it.
Convert the font style to an integer and save/load it.
Thanks Herfried, but I did try that and Windows complained about
conversion... To be honest, I used the VAL function (as I did above
for the size of the font) which doesn't return and INT type, but I
assumed that because of the error I was getting, that this wasn't just
a simple enumeration where any numeric value should work.
I will definately look again.
Hello,
"Snorton" <we*******@127.0.0.1> schrieb: Convert the font style to an integer and save/load it.
Thanks Herfried, but I did try that and Windows complained about conversion... To be honest, I used the VAL function (as I did above for the size of the font) which doesn't return and INT type, but I assumed that because of the error I was getting, that this wasn't just a simple enumeration where any numeric value should work.
Untested:
Did you try "CType(Integer.Parse(<string value representing integer>),
FontStyle)"?
Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET http://www.mvps.org/dotnet This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Svennglenn |
last post by:
I'm working on a program that is supposed to save
different information to text files.
Because the program is in swedish i have to use
unicode text for ÅÄÖ letters.
When I run the following...
|
by: RooLoo |
last post by:
Hey all!
Using VB.Net... How can I save the font properties of a textbox to an ASCII
file and later read the file and apply the properties back to the textbox?
Users use multiple workstations,...
|
by: RCS |
last post by:
I have an app that I have different "sections" that I want to switch back
and forth from, all while having the server maintain viewstate for each
page. In other words, when I am on Page1.aspx and...
|
by: forest demon |
last post by:
for example, let's say I do something like,
System.Diagnostics.Process.Start("notepad.exe","sample.txt");
if the user does a SaveAs (in notepad), how can i capture the path that
the user...
|
by: schneider |
last post by:
Hi all,
I'm trying to create a nice navigation for an asp.net 2.0 website.
What I want to do is use css to define the look of the tree. My
problem is that I cannot set margins or paddings via...
|
by: deepakNagpal |
last post by:
hi,
this is deepak, i got stuck in a script where i want to apply a platform specific css. i will be greatful if anyone could help me out.
My PHP code is:
<?php
$agent =...
|
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= |
last post by:
I want to change the font color and weight at a specific position in the text.
I am not sure where or what I need to do. It will be at position 155/156
from the left on each line.
Here is the...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| | |