473,378 Members | 1,451 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,378 software developers and data experts.

Casting Font object into Element--- Need Help!!

18
Hi all

I really need a solution for the following::
-------------------------------------------------------------------------------------
Font newFont= domainAxis.getTickLabelFont();
Element newFont = (Element)newFont;

newFont.setAttribute("kerning", "no");
newFont.setAttribute("family","SansSerif");
newFont.setAttribute("name","SansSerif");
newFont.setAttribute("style","plain");
newFont.setAttribute("size","10");

domainAxis.setsetTickLabelFont((Font)newFont);
-------------------------------------------------------------------------------------

But this gives a Casting exception!!
Ho to do the casting

Regards
Madumm
Jan 18 '07 #1
1 1045
r035198x
13,262 8TB
Hi all

I really need a solution for the following::
-------------------------------------------------------------------------------------
Font newFont= domainAxis.getTickLabelFont();
Element newFont = (Element)newFont;

newFont.setAttribute("kerning", "no");
newFont.setAttribute("family","SansSerif");
newFont.setAttribute("name","SansSerif");
newFont.setAttribute("style","plain");
newFont.setAttribute("size","10");

domainAxis.setsetTickLabelFont((Font)newFont);
-------------------------------------------------------------------------------------

But this gives a Casting exception!!
Ho to do the casting

Regards
Madumm
Ok now post the code that gave you the class cast exception because the code you posted does not compile. You declared two variables called newFont

Expand|Select|Wrap|Line Numbers
  1. Font newFont= domainAxis.getTickLabelFont();
  2. Element newFont = (Element)newFont;
(notice how I used code tags there) that will not compile and will say newFont is already defined.
Jan 18 '07 #2

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

Similar topics

1
by: Philip K | last post by:
I was trying to use Soap serialisation to save some systems settings how ever it fails if the settings contain a Font object, works fine if the Font object is not in the object being serialised. ...
2
by: Karl Meissner | last post by:
I am having problem casting from object. I want to pass in an value type as an object and then store it as a particular type. The cast from object throws an exception if the types do not match. ...
1
by: Steven | last post by:
VB.NET Via the FontDialog I have retrieved a font. After saving the font (in an XML document) and retrieving it again, I have a string in the following "format"; How can I convert this...
5
by: Diffident | last post by:
Hello All, I have a 2-dimensional array that I am storing as a session variable. I have no idea on how I can cast the session variable back to 2-dimensional array. Any pointers? Reference...
2
by: Patti | last post by:
I am building an application using VB.NET 1.1 and I have an issue with Font properties in my Radio Button Lists and Check Box Lists. My issue is that the Font Names and Font Size for these...
1
by: madumm | last post by:
Hi all I really need a solution for the following:: ------------------------------------------------------------------------------------- Say i have a font object called 'myFont' as shown below;...
8
by: Z1P2 | last post by:
Line 22 Char 1 says object expected in the following code. For the life of me I can't figure out what it is. I'm sure I'm just overlooking some stupid bit of formatting or something. ...
1
crystal2005
by: crystal2005 | last post by:
Hi i encounterd some problem when i implement CSS for rounded Corner table. Need help please... :D <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />...
3
by: SM | last post by:
I'm using simpleXML in PHP and i Can't get this small piece of code to work? Need help I have an XML that looks like this: <?xml version="1.0" encoding="utf-8"?> <VIDEO> <item>...
1
by: Dansmith122 | last post by:
Hi I have been working on the java script for my website and I need help with the out put variables. I need to know how to add more variable for each row in my survey. I am very lost ...
0
isladogs
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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...

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.