|
|
I have a complex arraylist containing N types of objects.
public class cls1
{
property string p1;
property bool p2;
property string p3;
property string p4;
}
public class cls2
{
property int p1;
property string p2;
property bool p3;
property string p4;
}
Class cls3
{
property string p1;
property bool p2;
property int p3;
property string p4;
property string p5;
property string p6;
}
I want to bind the grid ROWS (NOT COLUMNS) with the arraylist containing rows of type cls1, cls2, cls3...clsN.
Like one row can contian data of object of cls1 .
Like other row can contian data of object of cls2 .
HARMINDER SINGH, R&D, WinShuttle Inc,
|
|
|
|
|
Hi
I would like write the function that does the same behavior of following C++ code. I tried to use the Process but I am sure I'm using it in worng way. Would you please guid me to the correct way to run the simple cmdLine?
This is the way I use the Process and it opens the winzip application and does nothing.
//progName = "c:\program files\winzip\winzip.exe"
System.Diagnostics.Process.Start(progName, cmdLine);
CString cmdLine;
cmdLine.Format("wzunzip -d -o \"%s\" \"%s\"",fileName,folder);// setting command line
System(cmdLine); //where cmdLine = "unzip "c:\a.zip" "c:\extractedfiles"
Thank you.
|
|
|
|
|
Specify arguments by setting Arguments property of ProcessStartInfo object and pass it to Process class object
|
|
|
|
|
Thank you for your answer Giorgi.
I tried this way but got error...
pStartInfo.CreateNoWindow = true;
pStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
pStartInfo.UseShellExecute = false; //and also tried with Yes
pStartInfo.Arguments = cmdLine;
pStartInfo.FileName = progName;
pStartInfo.RedirectStandardError = true;
System.Diagnostics.Process.Start(pStartInfo);
|
|
|
|
|
What is the actual value of cmdline that you passed?
|
|
|
|
|
The actual command line that I'm passing is:
wzunzip -d -o "c:\sample.zip" "c:\outputfolder"
in C++ I simple has to pass the string to system(cmdLine ) function,
void ExtractZip(CStirng fileName,CString folder)
{
CString cmdLine;
cmdLine.Format("wzunzip -d -o \"%s\" \"%s\"",fileName,folder);// setting command line
System(cmdLine);
}
|
|
|
|
|
Are all the arguments and parameters correct? What error are you getting? What happen if you run the program which you want to start from cmd with those arguments?
|
|
|
|
|
You are right, Giorgi..
My argument isn't correct.
I found my error and now is working great.
Thanks for your advises and help.
^_^
|
|
|
|
|
You are welcome, glad that I helped you
|
|
|
|
|
Hey,
anyone know the equivalent of VB's MOD, in C#?
Cant find it
|
|
|
|
|
it's the percent symbol:
int n = 10 % 3; n == 1
|
|
|
|
|
|
|
|
|
Daniel Grunwald wrote: Daniel Grunwald
Strangely, I remember trying something on that once and finding that it didn't work, so went back to the developerfusion hosted one. This would have been about a year ago.
Kevin
|
|
|
|
|
Send me a mail if something doesn't work. Note that our converter currently only accepts code that would be valid syntax as a file (whole compilation unit) - this means you can must post whole class definitions, code snippets won't be recognized correctly.
|
|
|
|
|
Daniel Grunwald wrote: Note that our converter currently only accepts code that would be valid syntax as a file (whole compilation unit)
Ah, that would be it then. In that case it would be more useful if it was like the developerfusion version.
Kevin
|
|
|
|
|
OK, I'll try to implement that.
But from a converter, I expect that it gets most things right. Here is a test case that our converter does right, but many others don't:
using System;
public class MyClass
{
string abc;
public string Abc { get { return abc; } }
static void M<T>(params T[] args) where T : IDisposable
{
Console.WriteLine("Hello!");
}
}
Difficulties:
1) realizing MyClass is not a valid identifier in VB
2) renaming abc to not conflict with Abc, since VB is case insensitive
3) not dropping comments
4) supporting generics - .NET 2.0 isn't new anymore in 2007
5) not messing up the ParamsArray parameter
6) noticing M<t>() is a private method because the C# default is private. In VB, it must read "Private Shared Sub" because the default visibility in VB is Public.
All of these at not uncommon in C# code (e.g. "Stop" might be a C# method name, but is VB keyword).
The Telerik converter is quite good (gets all except #2 and #6 right), our converter gets all right (because I created the example based on our unit tests), all others I tested failed miserably.
For SharpDevelop/NRefactory 3.0, I'm looking into making the converter aware of the code semantics - so that VB->C# can get a(1) converted to a[1] or a(1) depending on what a is. And make VB->C# fix up inconsistencies in the casing.
Last modified: 31mins after originally posted -- added difficulty 6
|
|
|
|
|
In my scenario I was:
1. Still using .Net 1.1.
2. Mostly doing C# to VB snippet conversions.
In this scenario, the developerfusion site was adequate enough.
I had been doing C# for a few years before having to work on a VB project.
It would be nice if you could get yours to do snippets though because often we see articles in one language, where we just want to convert a few lines or a method. Often there isn't a full compilation unit presented.
Kevin
|
|
|
|
|
|
I am trying to store strings with embedded escape characters in a resource file, for example:
An error occurred:\r\n{0} However, when the string is retrieved, the escape characters are not read correctly, and I end up with a string such as this:
An error occurred:\\r\\n{0} which is not terribly useful.
According to this[^] article, I can call
String.Replace( "\\r", "\r" ); on the string, but this seems a little silly...
Is this really the "standard" way of storing and managing escaped strings or am I missing something fundamental here?
|
|
|
|
|
|
It's not the escaping characters I'm having a problem with - it's the fact that I can't load them from a resource file without losing the fact that they're "special" characters.
For example, the newline character (\n) becomes two characters, a slash and the letter 'n'. I could run String.Replace on the string to turn it back to something useful, but it shouldn't be translating my string in the first place. Besides, running String.Replace just seems like a huge hack.
VC++ 6 could store and retrieve escaped strings from resource files with no problem, but I can't seem to get it to work as expected in Visual Studio 2005.
|
|
|
|