|
On an indented view, it would be more obvious, but it seems your Entrance method is not
inside any class, and that's what gets rejected.
In C# all code and data must reside inside a class, a namespace can only contain types
(such as class, struct, enum).
If your coming from C or C++ this may be a surprise.
Now when you create a project in Visual Studio, you will get a class for free
(named Form1 or something, depends on the kind of project).
Also I expect the compiler to tell you exactly which line it did not like.
If all of this is mysterious, I suggest you start reading a book on C# and have
a look into one of the beginners articles on CodeProject...
Luc Pattyn
|
|
|
|
|
Thanks for your prompt response. I do have a C++ background thus thinking by using Void it should be covered but evidently not so. I tried using additional brackets but to no avail. I receive the following error:
Program 'C:\Class Test\Class Test 2\obj\Debug\ClassTest2.exe' does not have an entry point defined
As to your suggestion about using a C# book I have started doing that and ironically this code was one copied directly out of the book.
Thanks
-- modified at 19:20 Tuesday 30th January, 2007
Skan
If you knew it would not compile why didn't you tell me?!?!?!
|
|
|
|
|
Skanless wrote: ironically this code was one copied directly out of the book.
If this was a Microsoft Press book then I'm not surprised. Many code examples in MS Press books have had syntax errors in them. There is obviously not enough QA done at the proof reading stage.
|
|
|
|
|
Your guess was right...................it is a microsoft press book and I have to admit that I had found several error in there ASP.net book too but I di not know C# enough to identify the errors. Wow...............I guess there are a lot of people who use these book just to find out how erroneous they are.
Skan
If you knew it would not compile why didn't you tell me?!?!?!
|
|
|
|
|
I have a DataGrid and also this code:
Can tell me anyone syntax for my code?
code: DataBinder.Eval(Container, "DataItem.id&ort", "detalii.aspx?id={0}&ort={0}")
Thanks
|
|
|
|
|
This code goes in your template for columns in your grid. It should get the item specified by the second parameter, and presumably stuff it into the {0} parts of the format string, which it then returns.
Do you want to get two values out ? You'd have to do that seperately, I generally write a code behind method that I pass the data item to, and evaluate it in code.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Yes i want to get two deferent values out and i dosn't know syntax for this.
It help me much if you can tell me how to do this.
My problemns is that i need to get two values from databasesn in browser
Thancks
|
|
|
|
|
I don't know any way to do it in the ASPX. Like I said, I've always done it by passing the DataItem itself to a method in the code behind which finds the values required, builds and returns the string.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I’m trying to grab an image off a System.Windows.Forms.WebBrowser object. I can’t find a method that will tell me if it is selected. If I command it to be selected, it toggles between selected and not.
Here is some code to show the usage…
webBrowser1.Select();
Bitmap docImage1 = new Bitmap(webBrowser1.Width, webBrowser1.Height);
webBrowser1.DrawToBitmap(docImage1, new Rectangle(webBrowser1.Location.X,
webBrowser1.Location.Y, webBrowser1.Width, webBrowser1.Height));
file = "c:/tempB" + j + ".bmp";
docImage1.Save(file, System.Drawing.Imaging.ImageFormat.Bmp);
Hope someone can help
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
The Focused property sounds like it may help you.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
I have got the Apress book Beginning C# Databases: from Novice to Professional, and have been very pleased with it, But because it was written before Microsoft Visual C# 2005 came out, some things are a bit out of date. I have managed to get around most of them except this one:
It tells me to add a DataGrid to the designer view, but all I could find was DataGridView, and after some scripting, I have to "Bind the data grid at run time" using the script:
dataGrid1.SetDataBinding(dataset1, "employees");
I understand what the code is doing but the class DataGridView does not have a SetDataBinding function and so do not know how to bind the DataGridView1 object to the dataset.
Please help.
Thanks,
Any reply is appreciated.
I will also post this in the ADO.NET section
|
|
|
|
|
Before I put a lot of effort into writing something from scratch, I bet someone out there already has most of what I need. I need to extract some data out of a log file.
What I need to do is search a text file for a given string to find the first line of a block of data I want to process, extract some data out of that line, then read the next line and use a value in that to know how many more lines to read and process before looking for the next block and doing it again…and again…and again till the end of the file is reached.
Pretty simple, but why reinvent the wheel? And I bet there are some really cool ways of doing this I would probably never think of.
While you are at it any recommendations/warnings on doing this with VERY large text files (>2Gb)?
David Wilkes
|
|
|
|
|
Hi, I think it is not wise to have log files that large.
Why not create a series of normal sized log files instead ?
Just start a new file each day/each hour/whatever is appropriate.
Simply include the date/time in the file name to keep them apart.
You can keep them all in one folder, and if you need to transfer them
as a single entity, a Zip utility would take care of that
(as well as reducing overall size for you).
BTW Notepad is probably not the optimal answer to your question.
Luc Pattyn
|
|
|
|
|
Thanks for the advice but that presents some problems of its own because there are other tools that have to make use of these logs.
Most of the time I will be processing 3 log files at a time of around 900Mb each. Needless to say it takes a while... You should see how long it takes to FTP them...every Monday.
I could break the logs up into smaller files, but I still end up having to process the entire volume as a whole anyway, as well as change the setup of the other tools. So I would like to avoid this if I can.
David Wilkes
|
|
|
|
|
Well, you could surely improve things:
1) before file transfer, try compression; again a ZIP utility is useful, even for a single file.
On text files it would reduce size by a factor of about 3 to 5.
2) if you can modify the app that logs, you could leave everything as is, but add something
that creates another file containing exactly (or approx) what you are really interested in.
3) I dont know what the underlying business logic is, but requiring that amount of text
to be collected, transfered, and analyzed seems very strange to me. I would say
the overall process deserves reconsidering.
Luc Pattyn
|
|
|
|
|
This is a system that I sometimes think that Rube Goldberg designed.
We are talking about a Cellular Phone system running on a UNIX platform (messing around on it is not an option). The available tools and interfaces are archaic at best, and my knowledge of UNIX…well lets say I know just enough to get into trouble. The volume of data while unfortunate is still only 1/3rd of what is actually collected, and I’ve reduce about as far as I can while still maintaining its integrity and validity.
So, does it suck? Sure. But one of the reasons I like this job is that it is always a challenge…and this is today’s…tomorrow? Who knows, maybe I’ll have to solve Cold Fusion.
David Wilkes
|
|
|
|
|
I've run large log files for new processes, full throttle on Debug level. Also, unknown or old code may have large log files. Size is not the problem here.
What I've done is read the articles on making an xml file or database (after xml) of a logfile. There are good articles on using .NET regex to parse a file and put it into xml.
An overview article, a bit light on details, is
http://msdn2.microsoft.com/en-us/library/ms972965.aspx
This way you can rationalize the files, normalize them to a dB, then really look at the contents.
Good luck.
|
|
|
|
|
Finally got a chance to look at the link you provided.
This looks like it will work. I never expected I’d be able to simply locate the desired data based upon its pattern, but I was able to write a RegEx using Expresso that does it (at least on a small sample log).
Now all I need to do is code it and see if it will work for the big files.
Thanks!
David Wilkes
|
|
|
|
|
Also, rereading your original post, you need some grammatical structure here. Read the articles on Yacc, or for .NET anything that is a Yacc-like parser. The article on
http://www.codeproject.com/csharp/minossecc.asp
seems helpful. Search around, I can't put my finger on it but there are other non-Java .NET parsing meta-languages to help with the file structure.
There's always MKS Lex and Yacc -- I've used a long time ago to great effect, not too hard to learn (days). But, find something free if possible.
Cheers.
|
|
|
|
|
I'm overriding an Equals() method in .NET which a type specialization in mind but don't want to kill my code in stupid ways. So:
public override bool Equals(object obj)
{
if ( obj.GetType() == typeof(double) )
// foo
else
return base.Equals(obj)
}
The line to optimize is "if ( obj.GetType() == typeof(double) )". The constant typeof(double) calls is a waste. Tried "if ( obj.GetType().Name == "System.Double" )" with horrible results.
Any optimizations out there? Thx!
|
|
|
|
|
You could store the result of this call to a variable that's used by the comparison.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
if (obj is double) ... else ...
Luc Pattyn
|
|
|
|
|
if (obj is double) wins!
Gives me 2x speed over obj.GetType() == typeof(double).
Thanks!
|
|
|
|
|
As far as performance goes, there are only two rules:
1) shorter code is always faster
2) rule 1 is false
Luc Pattyn
|
|
|
|
|
I didn't think that 'is' would work for a value type ? Or is that just 'as' that won't work ( as it can't return null ) ???
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|