|
How do I fix this error which says
"The namespace 'Game' already contains a definition for 'Form1'"
What does it mean and how do I fix it.
It resulted after I wrote this;
public class Form1: System.Windows.Forms.Form
Thanks.
|
|
|
|
|
Angelinna wrote: how do I fix it.
Try naming your forms something descriptive when you create them, rather than the default VS throws at you
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Tried to.Still not fixed. When I put a descriptive name, it tell me that namespace with that descriptive name already contains a definition for that name .
|
|
|
|
|
You've got two forms with the same name. Rename the forms, not the namespace
(If this isn't working, post the code where you declare the namespace and form so we can see what is happening)
Simon
|
|
|
|
|
Angelinna wrote: Tried to.Still not fixed.
By any chance did you remove the partial keyword?
*jaans
|
|
|
|
|
|
Yes. I removed it earlier on.
|
|
|
|
|
Angelinna wrote: Yes. I removed it earlier on.
Why?
|
|
|
|
|
Well, put it back and see if that works with your rename of the form etc.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
sorted.Thanks.
modified on Saturday, October 18, 2008 5:21 AM
|
|
|
|
|
Asside from the fact that you are missing several close brackets '}', which I'm assuming are just because you didn't copy and paste them.
You need to put the word 'partial' back into your code.
You can't just go removing word without understanding what they mean.
The main declaration of the from should be
public partial class Form1 : Form
The declaration in the Designer.cs file should be
partial class Form1
Simon
|
|
|
|
|
When I do that correction, it then tell me that
Error The type 'TictacGame.Form1' already contains a definition for 'Startbutton'
and the same for all the buttons shown in the code in my previous message.
Why is that?
|
|
|
|
|
Angelinna wrote: Error The type 'TictacGame.Form1' already contains a definition for 'Startbutton'
Because you've probably declared them twice.
Just a quick suggestion. Don't go messing with the code in the Designer.cs file. That's how you've got yourself into this mess. Stick to just using the GUI.
Simon
|
|
|
|
|
Simon Stevens wrote: Don't go messing with the code in the Designer.cs file.
I tell my students that all the time, and yet, when they have some sort of mess up, that is the root cause.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
try to change the input parameters of the Constructor
|
|
|
|
|
Hi,
How can we change the Excel Chart Series Option (Second Plot last value) in C#?
Here is the picture in Excel
http://www.flickr.com/photos/31464532@N02/2948659930/
Here is my code..
ChartObjects chartObjects = (ChartObjects)activeSheet.ChartObjects(Type.Missing);
Range range = activeSheet.get_Range(cellStart, cellEnd);
ChartObject obj = null;
obj = chartObjects.Add(leftLocation, topLocation, chartWidth, chartHeight);
obj.Chart.SetSourceData(range, XlRowCol.xlColumns);
obj.Chart.HasTitle = true;
obj.Chart.ChartTitle.Text = title;
obj.Chart.ChartTitle.Font.Bold = true;
obj.Chart.ChartType = XlChartType.xlBarOfPie;
Series series = (Series)obj.Chart.SeriesCollection(1);
obj.Chart.ApplyDataLabels(XlDataLabelsType.xlDataLabelsShowLabelAndPercent,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing,
Type.Missing);
It seems not easy to find article for this one, so if somebody can help i would really appreciate it.
Thanks
|
|
|
|
|
I finally got the solution :
ChartGroup gp = (ChartGroup)obj.Chart.ChartGroups(1);
gp.SplitValue = 3;
I replied to my mail so that this may serve as help also to others.
Thanks for the effort of those who tried to response.
|
|
|
|
|
I am using Active Xperts SMS and MMS toolkit (trial) to send MMS to mobile phone through a modem.
I want to send the image captured by an internet camera. Im stucked on how to attach the image (bitmap) before send the MMS.
Im using the projects Camera Viewer and Motion Detector uploaded in the code project to connect and detect if an intrusion occurs.
So, can anyone guide me on how to send MMS?? Thank in advance.
Regards,
Nagesh
|
|
|
|
|
Active Xperts have a forum. You should try asking there.
Simon
|
|
|
|
|
Hi, how can i use this object? never needed so far, but i want to see if helps me somehow
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
I have created a program to enter sites and preview them in the WebBrowser control. The problem is that sometimes when I login to a site, for example it says:
"Welcome Trapper"
and afterwards if I intend to login to the site with a different user, it would not allow this, by still saying "Welcome Trapper". The website has no logout feature, and is probably intended to preserve the user after being logged in.
If you close the program and open it up again, the site would require a username and password (which is what I need) but it is not efficient to have to close and open your program every time a login is to be made.
I have already implemented the code below:
HttpRequestCachePolicy policy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
HttpWebRequest.DefaultCachePolicy = policy;
but I need to find something which will totally remove any tracks of the user so the site will ask for my login creditentials every single time... Any help?
|
|
|
|
|
If the site uses cookies, that might be causing the auto login.
Depending on how many sites your app works with, you could try simply deleting the cookie each time before you load up the site.
|
|
|
|
|
Hi,
I have the same problem....
Have you solved your problem? How?
Please let me know..
|
|
|
|
|
Hi,
I'm trying to validate an Xml document using an XmlReader. Here is my code:
private void Validate(TextReader source, string xsd)
{
XmlReaderSettings settings = new XmlReaderSettings();
XmlUrlResolver resolver = new XmlUrlResolver();
settings.ProhibitDtd = false;
resolver.Credentials = CredentialCache.DefaultCredentials;
settings.XmlResolver = resolver;
settings.ValidationFlags = XmlSchemaValidationFlags.ProcessSchemaLocation;
settings.ValidationFlags |= XmlSchemaValidationFlags.ReportValidationWarnings;
settings.Schemas.XmlResolver = resolver;
settings.Schemas.Add(null, xsd);
settings.Schemas.Compile();
//settings.Schemas.Add(null, http://www.w3.org/2001/xml.xsd);
settings.ValidationType = ValidationType.Schema;
settings.ValidationEventHandler += ValidationHandler;
XmlReader reader = XmlReader.Create(source, settings);
while (reader.Read())
{
}
}
The xsd of the xml document I want to validate contains an xs:import that points to local xsd (the schemaLocation is, as example "./dc.xsd"). This xsd imports serveral other xsd, one of which is the following:
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/03/xml.xsd">
</xs:import>
When settings.Schemas.Add(null,xsd) is executed, all nested LOCAL xsd are correctly resolved by the XmlUrlResolver I created. If i inspect during debug my XmlReaderSetting instance i can see tha all the required xsd are correctly loaded, EXCEPT http://www.w3.org/2001/03/xml.xsd. Then settings.Schemas.Compile() is executed, an exception is raised telling me that the attribute xml:lang is not defined (it's defined in the missing xsd).
This exception is not raised, and validaion is performed correctly, if i manually add the namespace (see the commented line of my code), or if i change the scema location in the xsd file to point to a local copy of xml.xsd (schemaLocation="./xml.xsd").
I would like to know how can I make this work, because i don't want to add manually anything related to this specific scenario (i.e. i would like to reuse the code). In other words, why this remote location is not resolved?
|
|
|
|
|
Hi all,
In one of our project(Windows Servcice) we are facing an issue like
After opening an Oracle Connection ,networks get disconnected before executing the finally block
So not able to close the Oracle Session and the connection is in inactive state for long time
untill we are killing it manually.
Like this we have an inactive sessions of around 165.
This makes the remaining applications getting down.
So please any one kindly guide me to resolve this issue
Thanks in advance
try
{
OracleConnection con = new OracleConnection();
con.ConnectionString = "User Id=scb;Password=scb;Data Source=137;"
con.Open();
}
catch(Exception e)
{
}
finally
{
con.Close();
OracleConnection.ClearPool(con);
con.Dispose();
}
|
|
|
|