|
When I was first reading about C# (circa 1999) someone said, "Isn't that the new Microsoft Java?"
|
|
|
|
|
Isn't it?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Java is more like C# and C# is more like Java. They share lot of common concepts. both are pure object oriented, and if you know C# it isn't difficult to learn Java. I can recommend "Head First Java" an excellent book from o'reilly to start with Java.
Sometimes Java framework like SOAP, EJB etc would scare you but once you are good with BASIC Java, Life would be much easier with them.
As far as you are concerned about the databases you can use any kind of database with Sun's ODBC drivers (just google to find them). And if you are looking to make a web application, You will need to know JSP (Java server pages, 99% like Java) and Servlets. JSP is client side and Servlet is server side scripting language.
I was a Java programmer, and I learnt C# with easy. Code project was always the best friend.
Happy learning,
Karmendra
|
|
|
|
|
Hello all,
how to configure trace listener to output trace statements to command window?
Thanks.
|
|
|
|
|
You have a custom listener in console application? If that's the case, just use Console.WriteLine.
|
|
|
|
|
its a windows application project where i want to configure tracelistener to output trace statements to command window. I have already sprinkled trace.writeline statement all over project and configured TextTraceListener, which outputs trace statements to text file.
|
|
|
|
|
As far as I know there's no 'native' support for that in framework, so I guess you should
- create a console application
- start a new process for that application
- use IPC to receive data from you trace listener
- write it to console
|
|
|
|
|
Hi Mika,
So, you mean:
1. If i configured Text trace listener to log statements to file say "TraceFile" under c:
2. The console application should watch that file ("TraceFile").
3. And if there are any changes to that File , get it and write it to console. (your way is IPC but i am thinking of FileWatcher control)
am i on right track?
Thanks.
|
|
|
|
|
Yes, you can do it that way also. When the file changes, you just have to know what lines are already written to console and write the new ones. Hopefully the FileSystemWatcher doesn't miss modifications if you're reading the file and it's modified at the same time. Also make sure that you don't lock the file while reading so that the listener is unable to write to it.
|
|
|
|
|
|
Member 2324483 wrote: am i on right track?
I don't think so. If you need the trace statements displayed in the command window, why to write it to a file and watch it? TextWriterTraceListener class has a constructor overload which takes TextWriter type. To output the trace to command window, follow the below steps.
1 - Goto project properties and change your project type to console application. This will start a command window with your form.
2 - Add the following code in the main .
static void Main() {
TextWriterTraceListener listener = new TextWriterTraceListener(Console.Out);
Trace.Listeners.Add(listener);
Application.Run(new YourStartupForm());
} You can see the Trace.WriteLine is writting to the command window.
|
|
|
|
|
Actually, i don't want to change my project type to console application. Its a product and i want to show trace output in separate window when it is enabled.
|
|
|
|
|
Hey,
im currently developing an application, one of the features of the app is that it creates
pdf files, but i want the files to be saved in a sub directory of where the application is
installed, but how do i code that?
thanks
|
|
|
|
|
You can use System.Reflection.Assembly.GetExecutingAssembly().Location . Just remove the application name part to get the directory portion and then add the subfolder you need.
|
|
|
|
|
Hallo - i hope somebody can help me....
i want to call a c-function with this code:
struct StrBox
{
char str[30];
};
struct StructBox
{
StrBox * box;
};
DLLIMPORT char * TestStrBox(StructBox *sb);
i used this c#-code to call it:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
struct StrBox
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 30)]
public string str;
};
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
struct StructBox
{
[MarshalAs(UnmanagedType.LPStruct)]
public StrBox box;
};
...
StructBox b = new StructBox();
b.box.str = "Hallo Welt!!!";
string str = TestStrBox(b);
but if execute it, i get:
Ausnahme System.TypeLoadException wurde im ausgeführten Programm ausgelöst:
Cannot marshal field 'box' of type 'marshal.StructBox': Invalid managed/unmanaged type combination (this value type must be paired with Struct).
So i think it have a problem, with the struct in the struct... but the struct HAVE to be in the struct
(this is just a test, who reflects a real issue).
Hope... somebody have an idea.
Sooo. Many thx in advance
|
|
|
|
|
Hi,
your C# code has a struct in a struct, your C++ code has a struct pointer in a struct.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Aahhh... ok!!
But how can i declare it in c#, that it is handled like a Pointer to a struct (is IntPtr the right way?)
|
|
|
|
|
Hi,
if the only thing you want to happen is passing a pointer, then IntPtr is the right type.
but that will not marshal the object pointed to, since IntPtr does not carry type information for you. You will have to explicitly marshal using Marshal.PtrToStructure() somehow.
I always try and avoid those complex marshal jobs. When both sides are mine, passing data is
implemented for minimal complexity, that's the only way I know to avoid everything getting copied
across the managed/unmanaged border.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Friday, June 10, 2011 11:55 AM
|
|
|
|
|
Hello folks.
I have a quick question, so here it is: can I restart a form back to it's original state as if it was newly opened without referencing a parent form or closing it? If so, how?
Thanks dudes and dudettes!
|
|
|
|
|
Never tried it, but perhaps if you:
- set this.components = null
- remove all controls from this.Controls
- call InitializeComponent
|
|
|
|
|
Holy crockpot!
It works:
components = null;
Controls.Clear();
InitializeComponent();
Are you some kind of suprogrammer?
Thanks, Mika!
|
|
|
|
|
Lodeclaw wrote: Are you some kind of suprogrammer
Now I have to ask a stupid question: What's a subprogrammer?
Lodeclaw wrote: Thanks, Mika
You're welcome
|
|
|
|
|
Not subprogrammer. Don't make me explain my terrible pun.
|
|
|
|
|
Ah, I misread it
|
|
|
|
|
I am working on a project to design database system of a library using oracle as backhand and c# as forehand but i don't know commands to connect
c# form with oracle database.
kindly send me command lines.
|
|
|
|