Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 17th, 2006, 06:35 PM
Friend of Wrox
Points: 2,876, Level: 22
Points: 2,876, Level: 22 Points: 2,876, Level: 22 Points: 2,876, Level: 22
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Denver, CO, USA.
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default Iterating Fonts

I have the following code, which worked fine in ASP.NET v1.1:

Dim ifcFonts As InstalledFontCollection = New InstalledFontCollection()
     Dim ffmFamily As fontfamily

     For Each ffmFamily In ffmFamily.Families
          ddFontType.Items.Add(ffmFamily.Name)
     Next

In converting to V2, the reference to FontFamily is now returning "fontfamily is not defined". WHat happened to FontFamily?
Reply With Quote
  #2 (permalink)  
Old March 18th, 2006, 01:29 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Try this:

Dim ifcFonts As Drawing.Text.InstalledFontCollection = New Drawing.Text.InstalledFontCollection()

Dim ffmFamily As FontFamily

For Each ffmFamily In FontFamily.Families
     ddfonttype.Items.Add(ffmFamily.Name)
Next
Reply With Quote
  #3 (permalink)  
Old March 18th, 2006, 11:11 AM
Friend of Wrox
Points: 2,876, Level: 22
Points: 2,876, Level: 22 Points: 2,876, Level: 22 Points: 2,876, Level: 22
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Denver, CO, USA.
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default

Same error plus it now tells me Type FontFamily is undefined as well. In any case, I've imported Drawing.text to avoid the longer reference.
Reply With Quote
  #4 (permalink)  
Old March 18th, 2006, 11:49 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Are you using Visual Studio 2005?
Reply With Quote
  #5 (permalink)  
Old March 20th, 2006, 09:59 AM
Friend of Wrox
Points: 2,876, Level: 22
Points: 2,876, Level: 22 Points: 2,876, Level: 22 Points: 2,876, Level: 22
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Denver, CO, USA.
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default

I am running inside of VS 2005 (v 8.0.50727.42) and Help About references Framework 2.0.50727. However, it is giving me fits trying to compile this program. While awaiting a response to this thread, I commented out the code in question so I could proceed with the conversion from FW 1.1. After correcting hundreds of new errors and lots more warnings, I finally got it to as point where it would try it compile. But when I try, it tells me:

Unable to start debugging on the web site. The server does not support debugging of ASP.NET or ATL Server applications. Click Help for more information on how to enable debugging.

If I tell it to go ahead, it eventually loads a page, but a drop down is missing and it doesn't appear to have a database connection. So something's not right, although I haven't the faintest idea what it might be.

Furthermore, I discover now when I exit and restart VS, it keeps asking me to configure the code to use ASP.NET 2.0. And when I click Yes, it says:

Configuring web site to ASP.NET 2.0 failed. You may need to manually configure this site for ASP.NET 2.0 in order for your site to run correctly.

This probably has something to do with the problems I'm experiencing, but I'm damned if I can figure out what to do about it. There's not much information available on-line about manually configuring sites for ASP.NET 2.0. I'm ready to burn the witch and re-install VS 2005 on another machine. Got a clue for me on anything worth trying before I start over?
Reply With Quote
  #6 (permalink)  
Old March 20th, 2006, 01:12 PM
Friend of Wrox
Points: 2,876, Level: 22
Points: 2,876, Level: 22 Points: 2,876, Level: 22 Points: 2,876, Level: 22
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Denver, CO, USA.
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default

To return to my inital question, HERE is the correct code to iterate through the available fonts and populate a drop down list:

Dim ffFamily As Drawing.FontFamily

For Each ffFamily In Drawing.FontFamily.Families
    ddFontType.Items.Add(ffFamily.Name)
Next

As to the issue of converting old ASP.NET programs to v2, I believe I have resolved my problems debugging, although my solution was, as usual, a work around. I had VS 2005 create a new web project for me with desired name. Then I manually added each of the form and class files from my old ASP.NET application to the new project. After numerous new error and warning corrections (v2 is so much pickier), I am now able to compile using the debugger.
Reply With Quote
  #7 (permalink)  
Old March 20th, 2006, 06:51 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

OK, bearing in mind that it was late and all that I was looking at initially was the errors generated from the code I copied from you - with the exception of the first line, isn't that pretty much what I had, although you would need to import the system.drawing namespace?

Mine:

-- obviously this line doesn't get used --> Dim ifcFonts As Drawing.Text.InstalledFontCollection = New Drawing.Text.InstalledFontCollection()

Dim ffmFamily As FontFamily

For Each ffmFamily In FontFamily.Families
     ddfonttype.Items.Add(ffmFamily.Name)
Next
Reply With Quote
The Following User Says Thank You to katsarosj For This Useful Post:
Ron Howerton (February 22nd, 2013)
  #8 (permalink)  
Old March 21st, 2006, 09:28 AM
Friend of Wrox
Points: 2,876, Level: 22
Points: 2,876, Level: 22 Points: 2,876, Level: 22 Points: 2,876, Level: 22
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Denver, CO, USA.
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default

Dim ffmFamily As FontFamily ' which worked in 1.1

vs.

Dim ffFamily As Drawing.FontFamily ' which works in 2.0

The reference to Drawing on the FontFamily object instantiation corrected the undefined reference error on that line. The change to the line instantiating the InstalledFontCollection to reference Drawing.Text, which you suggested, didn't fix the problem:

Dim ifcFonts As Drawing.Text.InstalledFontCollection = New Drawing.Text.InstalledFontCollection()

And in fact, was unnecessary because I was already importing Drawing.Text (although you obviously didn't know that).

Why referencing Drawing on the FontFamily instantiation is now necessary in 2.0 when it was not required by 1.1 is anybody's guess. MS probably doesn't even know. :D
Reply With Quote
  #9 (permalink)  
Old May 31st, 2006, 07:12 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Ron Howerton
 I am running inside of VS 2005 (v 8.0.50727.42) and Help About references Framework 2.0.50727. However, it is giving me fits trying to compile this program. While awaiting a response to this thread, I commented out the code in question so I could proceed with the conversion from FW 1.1. After correcting hundreds of new errors and lots more warnings, I finally got it to as point where it would try it compile. But when I try, it tells me:

Unable to start debugging on the web site. The server does not support debugging of ASP.NET or ATL Server applications. Click Help for more information on how to enable debugging.

If I tell it to go ahead, it eventually loads a page, but a drop down is missing and it doesn't appear to have a database connection. So something's not right, although I haven't the faintest idea what it might be.

Furthermore, I discover now when I exit and restart VS, it keeps asking me to configure the code to use ASP.NET 2.0. And when I click Yes, it says:

Configuring web site to ASP.NET 2.0 failed. You may need to manually configure this site for ASP.NET 2.0 in order for your site to run correctly.

This probably has something to do with the problems I'm experiencing, but I'm damned if I can figure out what to do about it. There's not much information available on-line about manually configuring sites for ASP.NET 2.0. I'm ready to burn the witch and re-install VS 2005 on another machine. Got a clue for me on anything worth trying before I start over?
Reply With Quote
  #10 (permalink)  
Old May 31st, 2006, 07:15 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Ron,

I am experiencing the exact same problem with debugging web apps in VS 8.0 ..have you found a solution..any help would be much appreciated...

Thanks
Karod

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Iterating through the LinkButtons in a page. nocofoolme ASP.NET 2.0 Basics 23 August 13th, 2008 04:01 PM
iterating through cols. of a recordset amit_p_patel VB How-To 3 May 24th, 2007 03:41 AM
Iterating through DropDownBox rsearing ASP.NET 2.0 Basics 8 January 3rd, 2007 04:35 PM
iterating through controls on a webpage badgolfer ASP.NET 1.0 and 1.1 Basics 1 November 19th, 2004 12:13 PM



All times are GMT -4. The time now is 06:01 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.