 |
| Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Visual Studio 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

November 15th, 2010, 03:39 AM
|
|
Registered User
|
|
Join Date: Nov 2010
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
cannot use var in a application
i have downloaded 1 application depends on visual studio 2008 but i convert the app into studio 2005, now hey triggering error like "var could not be found"
so what the other way to create variable without using var,
because am working on GMap.net? thats the problem?
please sort out my issue?
|
|

November 15th, 2010, 04:12 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
It depends on the exact cause of the problem. If the code was using var just to avoid specifying the type, you can manually fix it. E.g.:
Code:
var firstName = "Whatever";
var age = 20;
Can be replaced with:
Code:
string firstName = "Whatever";
int age = 20;
However, if the code assigns an anonymous type to the variable declared with var, it's not so easy to fix.
But why don't you download and install the free Visual Studio Express 2008 or even 2010 editions?
Imar
|
|

November 15th, 2010, 07:13 AM
|
|
Registered User
|
|
Join Date: Nov 2010
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
i need to deploy my application into CE device so i should work with .net framework 2 for that am struggling otherwise i can use 2008 only, string and int is ok, but i have different type of variable. thats the problem triggering here?
whats the solution for this?
|
|

November 15th, 2010, 07:29 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
whats the solution for this?
|
It depends on the actual code. Can you post some short samples of code that is causing problems?
Imar
|
|

November 15th, 2010, 07:54 AM
|
|
Registered User
|
|
Join Date: Nov 2010
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Its one of coding in one of file troubling me ?
Code:
#if !ContinuesMap
//Tile t = Core.Matrix.GetTileWithNoLock(Core.Zoom, tilePoint);
#else
Tile t = Core.Matrix.GetTileWithNoLock(Core.Zoom, tileToDraw);
#endif
// if(t != null)
// {
// // render tile
// lock(t.Overlays)
// {
// foreach(WindowsFormsImage img in t.Overlays)
// {
// if(img != null && img.Img != null)
// {
// if(!found)
// found = true;
//#if !PocketPC
// g.DrawImage(img.Img, Core.tileRect.X, Core.tileRect.Y, Core.tileRect.Width, Core.tileRect.Height);
//#else
// g.DrawImage(img.Img, Core.tileRect.X, Core.tileRect.Y);
//#endif
// }
// }
// }
// }
// add text if tile is missing
if(!found)
{
lock(Core.FailedLoads)
{
//var lt = new LoadTask(tilePoint, Core.Zoom);
//if(Core.FailedLoads.ContainsKey(lt))
{
//var ex = Core.FailedLoads[lt];
#if !PocketPC
g.FillRectangle(EmptytileBrush, new RectangleF(Core.tileRect.X, Core.tileRect.Y, Core.tileRect.Width, Core.tileRect.Height));
//g.DrawString("Exception: " + ex.Message, MissingDataFont, Brushes.Red, new RectangleF(Core.tileRect.X + 11, Core.tileRect.Y + 11, Core.tileRect.Width - 11, Core.tileRect.Height - 11));
g.DrawString(EmptyTileText, MissingDataFont, Brushes.Blue, new RectangleF(Core.tileRect.X, Core.tileRect.Y, Core.tileRect.Width, Core.tileRect.Height), CenterFormat);
#else
g.FillRectangle(EmptytileBrush, new System.Drawing.Rectangle(Core.tileRect.X, Core.tileRect.Y, Core.tileRect.Width, Core.tileRect.Height));
//g.DrawString("Exception: " + ex.Message, MissingDataFont, TileGridMissingTextBrush, new RectangleF(Core.tileRect.X + 11, Core.tileRect.Y + 11, Core.tileRect.Width - 11, Core.tileRect.Height - 11));
g.DrawString(EmptyTileText, MissingDataFont, TileGridMissingTextBrush, new RectangleF(Core.tileRect.X, Core.tileRect.Y + Core.tileRect.Width/2 + (ShowTileGridLines? 11 : -22), Core.tileRect.Width, Core.tileRect.Height), BottomFormat);
#endif
g.DrawRectangle(EmptyTileBorders, Core.tileRect.X, Core.tileRect.Y, Core.tileRect.Width, Core.tileRect.Height);
}
}
}
if(ShowTileGridLines)
{
g.DrawRectangle(EmptyTileBorders, Core.tileRect.X, Core.tileRect.Y, Core.tileRect.Width, Core.tileRect.Height);
{
#if !PocketPC
//g.DrawString((tilePoint == Core.centerTileXYLocation? "CENTER: " :"TILE: ") + tilePoint, MissingDataFont, Brushes.Red, new RectangleF(Core.tileRect.X, Core.tileRect.Y, Core.tileRect.Width, Core.tileRect.Height), CenterFormat);
#else
//g.DrawString((tilePoint == Core.centerTileXYLocation? "" :"TILE: ") + tilePoint, MissingDataFont, TileGridLinesTextBrush, new RectangleF(Core.tileRect.X, Core.tileRect.Y, Core.tileRect.Width, Core.tileRect.Height), CenterFormat);
#endif
}
}
}
}
//}
}
finally
{
Core.tileDrawingListLock.ReleaseReaderLock();
Core.Matrix.LeaveReadLock();
}
}
due to the error i make them as comment line Sir ?
|
|

November 15th, 2010, 08:03 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
You need to look at the return types of the methods you're calling when using var. E.g.:
Code:
var lt = new LoadTask(tilePoint, Core.Zoom);
...
var ex = Core.FailedLoads[lt];
It all depends on what LoadTask and FailedLoads return. If they, for example, return a LoadTask and an Exception respectively, you could rewrite it as:
Code:
LoadTask lt = new LoadTask(tilePoint, Core.Zoom);
...
Exception ex = Core.FailedLoads[lt];
IntelliSense can tell you what these methods return.
Cheers,
Imar
|
|

November 15th, 2010, 08:26 AM
|
|
Registered User
|
|
Join Date: Nov 2010
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Thank alot for your reply Sir,
Code:
foreach (var tilePoint in Core.tileDrawingList)
for this kinda code how can we find the datatype Sir, and please teach me how to use Intellisense Sir. Please
|
|

November 15th, 2010, 08:37 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
and please teach me how to use Intellisense
|
Just hover your mouse over an object or method call and you'll see a tooltip appear that describes the type.
Quote:
|
for this kinda code how can we find the datatype
|
You need to look at the definition of Core.tileDrawingList; it's probably a collection or an enumarable of some sort which may show you the type it is returning. If you have the source or documentation, this may be easy to find out. Otherwise, take a look at Red Gate's Reflector which enables you to look at the source of DLLs files.
Cheers,
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

November 15th, 2010, 08:51 AM
|
|
Registered User
|
|
Join Date: Nov 2010
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Hello Sir,
While hover in that Core.tileDrawingList it shows [ Systems.Collections.Generic.List<Gmap.Net.Point>Co re.tileDrawingList]
Sir,
so how can i intialize the variable of this loop
foreach(var tilepoint in Core.tileDrawingList) ?
|
|

November 15th, 2010, 09:05 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Take a look at this:
Code:
Systems.Collections.Generic.List<Gmap.Net.Point>
This returns a list of Gmap.Net.Point objects, so each item in the list is a Gmap.Net.Point.
Does that help?
Imar
|
|
 |