473,508 Members | 2,226 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB 2005 Text Box properties changes

4 New Member
Just started using Visual Basic 2005 and I have a text box that I want to change some Properties using some registry entries. (User can change font, size, color and style). Problem is I keep getting 'value of type string cannot be converted to 'System.Drawing.Font' when I try to change font, size, color, and style on each property using my registry values (variables). I tried converting current vb6, but it's too buggy and cannot find any good examples in knowledge data base. Any help would be appreciated.
Jun 6 '06 #1
4 7818
Banfa
9,065 Recognized Expert Moderator Expert
Post the code that is causing problems, however I am guessing that you have something like

Expand|Select|Wrap|Line Numbers
  1. dim RegFont AS String
  2.  
  3. REM code here to get font data from Registary into RegFont
  4.  
  5. TextBox.font = RegFont
  6.  
where you need something like

Expand|Select|Wrap|Line Numbers
  1. dim RegFont AS String
  2.  
  3. REM code here to get font data from Registary into RegFont
  4.  
  5. TextBox.font = System.Drawing.Font(RegFont)
  6.  
See http://msdn2.microsoft.com/en-us/sys...font.font.aspx
Jun 7 '06 #2
RaulSerr
4 New Member
Thanks Banfa, this pointed me in the right direction. I've listed the completed working code hoping it might help someone else. Thanks again.

'Visual Basic 2005

Button Control


'''''''''''''''''''''''''''''''''''''''''''''''''' ''
Dim RegFont As String
Dim RegSize As String

''''''''''''''''''''''''''''''
'Get the Regstry Font Settings
'''''''''''''''''''''''''''

REM code here to get font data from Registary into RegFont, RegSize
RegFont = GetSetting("My Database", "Options", "Font", """")
RegSize = GetSetting("My Database", "Options", "Font Size", """")
'''''''''''''''''''''''''''''''''''''''''''''''''' ''
If (RegFont <> "") Then
If (RegSize <> "") Then
' Create a new Font object Name and Size are required.
Dim f As New System.Drawing.Font(RegFont, RegSize)
' Assign the font to the control
TextBox1.Font = f
End If
End If

' Display formated text
TextBox1.Text = "AaBbCcDd12345!@#$%^&*()_+"
Jun 7 '06 #3
mracquaris
2 New Member
I hope i will also solve my problem

Thanks

------------------------------------------------------------------------
Nov 25 '06 #4
mracquaris
2 New Member
cau you plz tell me parameter details

"My Database", "Option", "Font", """"


thanks
-------------------------------------------
Nov 25 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
857
by: Joe Delphi | last post by:
Hi, I dropped a hyperlink text control onto my web page and set the font for X-Small and Italics to True. When I do a View In Browser it displays with the default font size and not...
1
1273
by: TH | last post by:
Could anyone please explain the bizarre and utterly infuriating effect I am observing while adding controls programmatically? I've reduced the problem to the following code: <form id=Form1...
1
2449
by: rmiah | last post by:
Hi I am using Visual Basic 2005. I have a stream of data which I want to set over 20 label.text properties. Instead of setting the data individually ie label1.text = ....label2.text=........
0
888
swatmajor1
by: swatmajor1 | last post by:
Hi There I wish to make a program which converts plain text to ASCII or binary, but don't know where to start. If anyone knows of any examples or tutorials that would help, it would greatly...
1
1045
by: George Ter-Saakov | last post by:
I am using Express Edition and working on new project with AJAX for whatever reasong when i am switch in design mode my page that uses TabContainer it modifies HTML <cc1:TabPanel ID="tb1"...
8
1121
by: Rob | last post by:
In VS2003 you had the option to select "Sub Main" as the Startup Object It appears this option is not present in VS2005... Is this the case ? Thanks !
4
1997
by: lavanyak6 | last post by:
have written a code for textbox in jsp <td><input type="text" class="textBox" name="potCommission" id="potCommission" size="10" value='<%=commission%>' <% if(!commissionFlag.equals("NG")){ %>...
7
1258
legteg
by: legteg | last post by:
I'm new to Access and VBasic and have been thrown into a pretty big project so needless to say I am having difficulties. I have developed a big project (regarding my knowledge level) and need to...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7383
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1557
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.