473,411 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

If Statement, Please Help

I am trying change the font size of text based on the menu item clicked. I
can not seem to get this statement to work.

Thanks in advance Perry

Private Sub MenuItem16_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem16.Click

Dim Width As Integer

Width = Screen.PrimaryScreen.WorkingArea.Width

If Width = 1024 Then SetSmallAFont()

ElseIf Width = 1280 Then SetSmallBFont()

Else

SetSmallCFont()

End If

End Sub

Nov 29 '07 #1
2 923
"plangla" <pl*****@hotmail.comschrieb
I am trying change the font size of text based on the menu item
clicked. I can not seem to get this statement to work.

Thanks in advance Perry

Private Sub MenuItem16_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MenuItem16.Click

Dim Width As Integer

Width = Screen.PrimaryScreen.WorkingArea.Width

If Width = 1024 Then SetSmallAFont()

ElseIf Width = 1280 Then SetSmallBFont()

Else

SetSmallCFont()

End If

End Sub
I don't know which problem exactly you have. Generally spoken, a Font's size
can not be changed. You have to create a new Font and pass the new size. See
the constructors of the Font class.
Armin
Nov 29 '07 #2
plangla wrote:
I am trying change the font size of text based on the menu item clicked.
The code you've posted doesn't show us /how/ you're trying to "change
the font size" - we have no idea what's in those three Set*Font()
routines - but, essentially, you can't change the font size anyway.
Annoyingly, you have to create a whole /new/ Font object, based on one
that you already have, and pass the new size into its constructor.

Dim basicFont as Font = Me.Font
Dim bigFont as Font = New Font( basicFont.FontFamily, 99 )

Also, your code doesn't take any notice of the menuitem at all - it's
all based on the screen size. Is that what you intended? Or did you
want a number of menu items, each of which would choose a different font
size?

HTH,
Phill W.
Nov 29 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: newbie_mw | last post by:
Seems my post was buried in more cries for help :-) I will try again. It's probably a very novice question so please take a look! Thanks!...
9
by: Brandon | last post by:
Greetings, I am having a problem getting a SQL statement that is functional in Access 2K to work in ASP. My Access SQL statement is this: SELECT DateAdd('s',Ticket_Opened_Date,'Dec 31, 1969...
5
by: WindAndWaves | last post by:
Hi Team The function below searches all the tables in a database. However, if subsearch = true then it searches all the objects listed in a recordset (which are all table names). I thought to...
6
by: FayeC | last post by:
I really need help figuring this out. i have a db with mostly text fields but 2. The user_id field is an autonumber (key) and the user_newsletter is a number (1 and 0) field meaning 1 yes the ...
35
by: Thierry Loiseau | last post by:
Hello all, and Happy end year 2005 ! Well, I would like to obtain a list of all JavaScript var statement, With "for...in" perharps ? That is bellow my recent test here, but the problem is...
4
by: Jack | last post by:
Hi, I have a asp page where part of the code is as follows. This builds up the sql statement partially. sql01 = "UPDATE EquipmentTbl SET " sql01 = sql01 & "SerialNumber = '" &...
14
by: Matt | last post by:
I need to add the following variable into an SQL statement and not sure how to do it. strGCID needs to be inserted into the following statement: SQL = "SELECT tblContacts.* FROM tblContacts...
18
by: dspfun | last post by:
Hi! The words "expression" and "statement" are often used in C99 and C- textbooks, however, I am not sure of the clear defintion of these words with respect to C. Can somebody provide a sharp...
5
by: wassimdaccache | last post by:
Dear Sirs; I'm trying to write SQL statement and it is not executing what I need. tables are: customers(customerID, customerName) ...
9
by: John | last post by:
Hello all. I am a PHP newbie and am having an issue using the && in an if statement. here is the code: if ($_REQUEST == "1" && date("Y-m-d") < $rowWork) { die("<h1>The earlybird special has...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.