|
Control has got way too many properties IMO. Deriving from it to create a new control is a PITA as you have to try and hide all the non relevant ones (and methods too) which is not only messy/time consuming but very non OOP.
If they had a IControl interface that just had the basics required, and a form's Controls property was a list of IControl it would be way better.
Something like
interface IControl : ISynchronizeInvoke, IWin32Window
{
bool Enabled { get; set; }
Point Location { get; set; }
Size Size { get; set; }
bool Visible { get; set; }
}
public abstract ControlBase: IControl
{
...
} It'll never happen though
[Edit] Made a mess of Interface with ControlBase stuff in it [/Edit]
Actually, now I've thought about it a few minutes - just the ControlBase (would need a little more than I provided so we can have OnPaint etc to override) would be enough. Give me ten minutes and I'll probably change my mind again!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
modified on Tuesday, May 12, 2009 11:20 AM
|
|
|
|
|
unless I'm missing the point entirely wouldnt it be something along these lines:
yourControl.Left = Convert.ToInt32(yourXPosTextBox.Text);
yourControl.Top = Convert.ToInt32(yourYPosTextBox.Text);
or at least thats how I position controls within a form, if you mean something else ginore me
|
|
|
|
|
Hi All,
I have a made the user control in C#,now i have faced the problem that i want to make the property in user control that pick up the data from database and display it in the list.....
Ex. ID Name
1 A
2 B
3 C
How is it possible in windows application...
Please help its urgent...
Thanks,
Lalit Narayan
|
|
|
|
|
lnmca wrote: lease help its urgent...
No, it's not at all. I asked everyone in the office, and they all agreed.
Is this homework, or paid work ? If the former, talk to your teacher so he knows how lost you are. If the latter, you're stealing from your clients. Getting data from a DB, and using it with databound controls is probably one of the most widely discussed things, in books and online. You don't go into enough detail to really know how to give an exact answer, but select * from myTable and myGrid.DataSource = myDataSet, is really all you should need to do.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
|
Actually, the answer is in there, you just need to be able to read, and to know something about programming. I can't write copy and paste code based on what you told us, nor would I do that for someone unwilling to learn.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Christian Graus wrote: No, it's not at all. I asked everyone in the office, and they all agreed.
|
|
|
|
|
|
Not by you, apparently....
Seriously, is google broken where you live ? Can you not read ? What I told you, IS the answer.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
lnmca wrote: Is it not possible to pick the data from database and show it in the property as in dropdownlist?
Yes.
My failometer is detecting vast quantities of FAIL!
"Its SQL - hardly programming..." (Caslen)
|
|
|
|
|
Hi,
I would like to be able to capture an image of an arbitrary window (though it is most likey that it will be a window I create). What is the best way to do this? I am currently using the Graphics.CopyFromScreen method to paint the section of the screen the window occupies to a bitmap but this has the obvious disadvantage that if the window is behind another, the image will also capture this overlap. Is there any other way of doing this that would solve this problem?
Thanks,
Steve
|
|
|
|
|
I believe the control themselves have a rendertobitmap method that you can call, which I assume triggers a paint event but renders to a bitmap, not the screen.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I had a look for one initially but didn't find anything. Having had another look I can see Control.DrawToBitmap, perhaps I should have looked harder the first time!
Thanks for your advice.
Steve
|
|
|
|
|
*grin* glad to help
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I have this task, i need to call a Java Application using a web-service call.I need to know if someone has a clue on how to do that,so far this is my attempt.
string cmd ="C:\Program Files\Java\jre1.6.0\bin\Java.exe";
string cmdParams="java -Xms32m -Xmx1g -Djava.library.path=d:\cep\col\sql -classpath d:\cep\col\commons-net-1.4.1.jar;d:\cep\col\commons-codec-1.3.jar;d:\cep\col\sql\sqljdbc.jar;d:\cep\col\DialogInput.jar za.co.lightWave.control.DialogInputControl";
using (Process process = Process.Start(new ProcessStartInfo(cmd, cmdParams)))
{
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError= true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.Start();
process.WaitForExit(timeout);
return process.ExitCode;
}
I need to know what is an effective way of executing that command,what i have currently is
java.lang.NoClassDefFoundError: java Exception in thread "main"
Thank you in advance
Mninawa
|
|
|
|
|
Hi,
Have you tried running the command you are attempting to run in the command line first to make sure that the command actually works? What you are getting is an error from Java that says it cannot find a certain class. This is almost always a problem with the classpath argument of the command. Try debugging the command in cmd.exe first and then once you are sure the command works, try doing it in code.
Steve
|
|
|
|
|
PS.
I just had a closer look at your commands. You are setting the command to call the Java virtual machine (Java.exe) which is fine. But you are then setting the first argument (in your cmdParams) to "java" then "-xms32m...etc". Did you mean to put jar instead of java? When you execute a JAR file on the command line it should be something like "C:\whatever\Java.exe -jar MyJar.jar". Take a look at the documentation for the Java Virtual Machine when running JAR files.
Steve
|
|
|
|
|
Hi Steve,thanx for your help.
On that not you are quite right,In the documentations for JVM,this is how you would execute .jar file,but now what i have is the combination of libraries,which makes up an application caller,which is that cmdParam,
well i have to find a way to execute them in C# and I thought using this way would solve the problem.
I thought one might have a solution besides the one in did,because i have to do them that way.
Mninawa
|
|
|
|
|
Hi,
1.
to execute a java class, you should issue the command "java [options] classname"
which means "java" is the command, and everything else is in the arguments.
So I would remove the "java " from cmdParams (I guess you already did that).
2.
Furthermore, in Java there is a direct link between composite class names (as in your "za.co.lightWave.control.DialogInputControl") and your file hierarchy. So your classpath (either the enviroment variable or the options you specify) must lead to the location that is holding
za\co\lightWave\control\DialogInputControl.class
java.lang.NoClassDefFoundError is the error you would get when not satisfying this requirement.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hello,
I wrote window application that has some datagrids and data from SQL. I saw in task manager that this application uses 23 MB memory. Is it considered as normal / high ? And if high how can i reduce it?
BTW it's only the beginning of the application writing. I will have to add much more datagrids and other stuff...
|
|
|
|
|
23MB is nothing to concern yourself with at all. It sounds quite modest to me, even for a small application.
Regards,
Rob Philpott.
|
|
|
|
|
.net memory management is different to non.net apps
See previous post and replies here[^] and here[^].
Simon
|
|
|
|
|
OK thanks.
But i am going to add much more datagrids to this application?
Does using with methods and classes reduces the memory usage or not?
I am nor worried now, but still there will be much more datagrids and stuff (about 10 times more datagrids)
|
|
|
|
|
michaelgr1 wrote: But i am going to add much more datagrids to this application?
It will be almost certainly be OK.
michaelgr1 wrote: Does using with methods and classes reduces the memory usage or not?
No, memory is not reduced, but it is good practise (because it improves maintainability) to divide your code up into clean logical blocks of classes the perform a single function and simple methods.
My advice is don't worry. If you reach a point in the future where your application starts to perform badly you can profile it then and reduce the bottle neck. It's almost impossible to predict in advance exactly where a bottle neck will occur, so don't waste time now trying to solve problems that you don't have yet. Besides, for data driven apps, the real bottle neck is almost certainly going to be related to loading the data from the database and nothing to do with memory usage on the client side.
Simon
|
|
|
|
|
Hi.
Does anyone know if it is possible to do a "search and replace" in the regex expression, without using the
RegEx.Replace method?
Alternatively: Does it exist a perl regex-library to be included i C#
Kjetil
|
|
|
|