|
Use a regex like:
@"width=(\d+) type=(.+)]";
if this matches, look in the match.Groups[0] for the first value, and [1] for the second value.
You can also use named captures:
@"width=(?<width>\d+) type=(?<type>.+)]";
and then use match.Groups["width"] and ["type"]. That really helps the readability of code.
|
|
|
|
|
Which programming language is better, when developing Windows Application?
C# or Visual C++ MFC
On the other hand C# seems easy to handle then MFC?
What do you think? Which on is stable ??
|
|
|
|
|
Right now you'd be better off with MFC.
Maybe 6 months later you might think C#
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Can i use remoting in a Win 9x/Me machine ?
|
|
|
|
|
Hi guys, I have a control that has some picturebox controls on it. I'd like that the form on which my control is placed recieves an event notification when a picture box control recieves a MouseDown event. Simple enough but I'd like to use events. Right now I'm not sure what the code should look like. How and where do I add the parent form as a listener for an event happening within a control embedded within another control?
Pseudo code will do.
Regards
Senkwe
Just another wannabe code junky
|
|
|
|
|
Add this code to the constructor...
this.pictureBox.MouseDown+= new System.Windows.Forms.MouseEventHandler(this.onMouseDown);
and the function which handles the mouse down...
private void onMouseDown (object sender, System.Windows.Forms.MouseEventArgs e)
{
}
This can be automated if you're using VS.NET...
Andreas Philipson
|
|
|
|
|
how do you automate this is VS.NET??
|
|
|
|
|
I'm trying to load an excel document into my application using Excel COM but I cannot get the Open () command to work... This is my code:
Excel.Application app = new Excel.Application ();
app.Visible = true;
app.Workbooks.Open (...)
the first parameter is of course the file name (as a string?) but what type of objects should the other parameters be???
Andreas Philipson
|
|
|
|
|
Use Missing.Value from System.Reflection for parameters that you want to have the default value
|
|
|
|
|
DVryce wrote:
What kind of statement do I have to use to get C# to reference the DLL?
You don't need any statements. If you have VS.NET, just add a reference to your MC++ dll from Solution explorer. If you work from the command line, you will need to reference the library when compiling your project.
I vote pro drink
|
|
|
|
|
I'm trying to play a bit with C# and multifile assemblies. Documentation mentions al.exe and csc.exe (linker and compiler) as tools needed for that but I can't find them in VS.NET RC. Anybody knows where to find them?
Thanks
CK
|
|
|
|
|
C:\WINNT\Microsoft.NET\Framework\v1.0.2914
Nish
p.s. For you C might be D or E
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Thanks a lot. I quiried only VS.NET directory so I missed them.
Regards
CK
|
|
|
|
|
Hi,
I am having some problems in calling a managed code( server) from an unmanaged client. I created a WebService Application in C# and a Win32 based console client. The client is working fine when both the server and the client are located on my computer( Windows 2000). However, invoking the client application from another computer on the same network results in an error, whose value is -2147221164. From the Error Lookup option, the message obtained correspoding to -2147221164 is "Class not registered".
So,i copy the entire client project on this other computer(Windows NT).It does not have a .NET compiler.On building the project in Visual Studio 6, gives an error which is: Unable to include atlsoap.h : No such File.
Can anyone suggest me how to deal with this queer problem and what these error messages signifies ??
Vivek.
|
|
|
|
|
In VS.NET right click on the references node in solution explorer.
Click "Add Reference", on the COM components tab choose the component you wish to use (OCX).
You might want to then add it to the toolbox as well, right click on the Toolbox tab you want to add it to, and choose "Customize Toolbox"; then select your COM component again.
HTH,
James
Sonork ID: 100.11138 - Hasaki
and a digital cookie (not chocolate chip, its computer chip) goes to whoever can be the first to tell me what Hasaki means. I know someone registered on here can tell me
|
|
|
|
|
Is there an easy way to maximize a winform at runtime?
For instance, by setting a property instead of getting the
screen dimensions and then specifying the size manually?
|
|
|
|
|
Use the WindowState property.
this.WindowState = FormWindowState.Maximized
James
Sonork ID: 100.11138 - Hasaki
and a digital cookie (not chocolate chip, its computer chip) goes to whoever can be the first to tell me what Hasaki means. I know someone registered on here can tell me
|
|
|
|
|
Hi everyone.
My situation is long but not very complicated. It involves custom web controls. Any help is very much appreciated.
I am building a custom web control. I am creating this control because I have a scenario where I need to dynamically output different types of content to a page (sometimes an image, sometimes a table, sometimes a string of text). As such, a label, or image or control wouldn't do. So, I created a custom web control. This control has a property for a URL string. The URL is inputted to the control and then it inputs the url to a SQL stored procedure. The stored procedure returns a value with the type of output to return (text, table, etc), and it renders the output based on the value. My problem is at compile time. When I compile my code, I get a bunch of errors which make no sense at all!
I'm not sure where it's coming from. Here the code from where I begin getting compile errors:
protected override void Render(HtmlTextWriter output) {
if (Format.Type == "Unknown") {
MyNameSpace.MyClass myClass = new MyNameSpace.MyClass();
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlCommand myCommand = new SqlCommand("GetOutput", myConnection);
// Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure;
// Add Parameters to SPROC
SqlParameter parameterPage = new SqlParameter("@URL", SqlDbType.NVarChar, 100);
parameterPage.Value = Format.Page;
myCommand.Parameters.Add(parameterPage);
SqlParameter parameterType = new SqlParameter("@Type", SqlDbType.NVarChar, 30);
parameterType.Value = ParameterDirection.Output;
myCommand.Parameters.Add(parameterType);
myConnection.Open();
SqlDataReader pageoutput = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
// check if it is a table
if ((String) pageoutput["TableCell"] != null) {
SqlDataReader dr = myClass.GetTableContents(Format.Page);
bool hasMoreRows = dr.Read();
if (hasMoreRows != null) {
// start writing the table
output.Write("table header cell here");
// it is on this next line that is 133, where the compile errors start occuring
while (hasMoreRows == true) {
// this if statement checks if the reader is an even or odd item depth, and
//if it is even it renders a different background color the table (creating
// an alternating patten effect)
if ((dr.Depth % 2) == 0) {
output.Write("alternating style table HTML here");
} else {
output.Write("normal table style here");
}
}
}
}
}
}
}
}
These are the compile errors. I've tried reworking those lines several ways, and nothing seems to fix it.
(133,45): error CS1525: Invalid expression term ')"
(133, 47): error CS1002: ; expected
(136, 38): error CS1026: ) expected
(136, 44): error CS1525: Invalid expression term "
(136, 45): error CS1002: ; expected
(136, 106): error CS1002: ; expected
(136, 106): error CS1525: ; Invalid expression term ')'
(139, 18): error CS1525: ; Invalid expression term 'else'
(139, 23): error CS1002: ; expected
(140,187): error CS1026: ) expected
(140,193): error CS1525: ) Invalid expression term "
(140,194): error CS1002:
Thank you very much for reading this whole message. Even if you can't help me
|
|
|
|
|
bool is a value type, not a reference type so you can't compare it to null.
The datareader returns true if there are more rows to read, and false if there are none.
Other than that, I see no errors on my end. I'm using RC0 on XP Pro
James
|
|
|
|
|
Is there a way to make a form show up as both an MDIChild and an MDIContainer? That is to have a top level window with sub-windows each of which has it's own sub-windows? I managed this once in C++ with MFC through a method much to complicated to describe here, but I'm totally new to C# and wondering if this is possible?
|
|
|
|
|
I just did a quick test and the following exception was thrown -
System.Exception: A form can't be both an MDI child and MDI parent.
So, if it is possible, it isn't done in the most obvious way. Maybe there is a complicated workaround?
|
|
|
|
|
Neill Jordan wrote:
I just did a quick test and the following exception was thrown -
System.Exception: A form can't be both an MDI child and MDI parent.
So, if it is possible, it isn't done in the most obvious way.
Yeah, I did get this far... Thanks for the attempt though. It sure as hell wasn't easy under MFC so it probably isn't easy this time around either. I guess this is a good indication that I should rethink my GUI design!
|
|
|
|
|
Here's some naming so I don't get confused while I'm typing this.
MDIParent
- MDIChild
- MDIGrandchild
On the MDIChild add a panel and set the dock style to fill; you may want to set the backcolor so it isn't the control color.
On the MDIGrandchild set the TopMost property to false, then add the MDIGrandchild to MDIChild's panel's control collection.
You'll probably have to add some logic for scroll bars and the Windows menu on the MDIChild, but that should work visually.
HTH,
James
[edit, fixed my naming chart so it didn't look like both were children were directly from parent]
|
|
|
|
|
My bad, its not the TopMost property, its the TopLevel property.
Guess thats what I get when I guess which of the two it was :P
James
|
|
|
|
|
Hi
I'm looking for the Intermediate language file for a C# DLL/EXE, but I'm either totally misunderstanding the concept or am looking in the wrong place.
I presumed that the MSIL file is very similar to an IDL-with implementation of course- and is also in PLAIN text.
What's going on?
Simon
Simon
"...Bill is watching..."
"An Object Is Simply A Referenced Thingy" quoted from Programming Perl
|
|
|
|