|
that's because that method takes 5 parameters and in C# there is no such thing as optional parameter, so you have to pass all of them.
public static string InputBox(
string Prompt,
[Optional] string Title,
[Optional] string DefaultResponse,
[Optional] int XPos,
[Optional] int YPos
);
|
|
|
|
|
Thank you for your reply. I'm having trouble getting the inputbox centered.
Here's my points (x , y): (this.Right / 2, this.Bottom / 2)
|
|
|
|
|
Hey folks,
May be this is a stupid question I am pretty new to C#.
I just wonder how can I call a static method using late binding. For example, I have a class with a private constructor and a static method.
Is it possible? if yes, then how?
Thanks a bunch.
|
|
|
|
|
It's possible, you just have to specify BindingFlags.Static
Type type = typeof(SomeType);
MethodInfo method = type.GetMethod("SomeStaticMethod", BindingsFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod);
method.Invoke(null, new object[]{});
|
|
|
|
|
Hi all,
¿Is it possible to compile 2 assemblies and making reference one to each other?
Example:
We want to compile MySoftware.exe and MyLibrary.dll, we do it as follow:
csc.exe /target:winexe /out:MySoftware.exe /reference:MyLibrary.dll
csc.exe /target:library /out:MyLibrary.dll /reference:MySoftware.exe
I want both assemblies to access the other assembly methods but at compile time is obviously that the other file does not exist, so compile error displays.
Thanx
|
|
|
|
|
A solution (but not the best) is to build a stupid MyLibrary.dll with the needed public class, but without implementation.
<br />
public class MyLibraryClass<br />
{<br />
public int ComputeSomething(int l, int r)<br />
{<br />
throw new NotImplementedException();<br />
}<br />
}<br />
Than build the exe against this stupid Library. Than build the real Library against the exe.
I have not tested this solution.
If you try it, please write your result.
Good luck.
Lars Niedziolka
|
|
|
|
|
Heinz Suez wrote:
csc.exe /target:library /out:MyLibrary.dll /reference:MySoftware.exe
You should not reference an executable. MSDN says: "At run time, you should anticipate that only one .exe assembly can be loaded per process, even though, there may be times when more than one .exe might be loaded in the same process. Therefore, do not pass an assembly built with /target:exe or /target:winexe to /reference. This condition may be modified in future versions of the common language runtime."
To solve your problem. Try either to move all functionality needed by MyLibrary into MyLibrary, so it can be compiled without referencing, or maybe create a second library that gets referenced by MyLibrary and MySoftware.
www.troschuetz.de
|
|
|
|
|
I am working on a project.One phase of it is to extract each frame from AVI movie and process it.In Visual C++ i have used the vfw32.lib to get frame.Now i am doing work in C#.Is there any library having built in functions to do the same thing or there is a way to use vfw32.lib in C#.My major task is to read each frame,store it onto Bitmap object and then do scanning whatever required
|
|
|
|
|
|
hi,
if i select all the text in the richtextbox and if i press clear or backspace then all the text isn't cleared, why?
code:
<br />
private void textBox_Receivers_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)<br />
{<br />
textBox_Receivers.SelectionStart = 0;<br />
textBox_Receivers.SelectionLength = textBox_Receivers.Text.Length;<br />
textBox_Receivers.SelectionFont = new Font("Arial", 8, FontStyle.Regular);<br />
textBox_Receivers.SelectionStart = textBox_Receivers.Text.Length;<br />
textBox_Receivers.SelectionLength = 0;<br />
}<br />
cu+thx
|
|
|
|
|
The text wasn't cleared because you don't select you set the selection length to 0
textBox_Receivers.SelectionLength = 0;
MCAD
-- modified at 20:24 Wednesday 31st August, 2005
|
|
|
|
|
|
The text wasn't cleared when you hit the keys because you're handling the keydown event and resetting the selection length to 0 before your KeyDown code is finished and before the textbox gets the keystroke.
What I'm guessing you have to do (I don't know what your requirements are) is in your KeyDown event handler, save the current SelectionStart and SelectionLength values before you change anything, then restore them back to what they were before after you're done making any changes.
private void textBox_Receivers_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
int saveSelStart = textBox_Receivers.SelectionStart;
int saveSelLength = textBox_Receivers.SelectionLength;
textBox_Receivers.SelectionStart = 0;
textBox_Receivers.SelectionLength = textBox_Receivers.Text.Length;
textBox_Receivers.SelectionFont = new Font("Arial", 8, FontStyle.Regular);
textBox_Receivers.SelectionStart = saveSelStart;
textBox_Receivers.SelectionLength = saveSelLength;
}
I have no idea why you would want to do this anyway. With every keystroke, you're resetting the font for your entire textbox to Arial 8pt. Why would you want to do this? Why not set it once for the entire textbox and be done with it?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi, thx look for my solution:
<br />
private void textBox_Receivers_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)<br />
{<br />
if(textBox_Receivers.Rtf.IndexOf("\\ul") >= 0) <br />
{<br />
if(e.KeyCode == Keys.Back || e.KeyCode == Keys.Delete || char.IsDigit((char)e.KeyCode) || char.IsLetter((char)e.KeyCode))<br />
{<br />
int SelectionStart_old = textBox_Receivers.SelectionStart;<br />
<br />
if(textBox_Receivers.SelectionLength != 0)<br />
{<br />
textBox_Receivers.SelectedText = "";<br />
}<br />
<br />
textBox_Receivers.SelectionStart = 0;<br />
textBox_Receivers.SelectionLength = textBox_Receivers.Text.Length;<br />
textBox_Receivers.SelectionFont = new Font("Microsoft Sans Serif", 8, FontStyle.Regular);<br />
textBox_Receivers.SelectionStart = SelectionStart_old;<br />
textBox_Receivers.SelectionLength = 0;<br />
}<br />
}<br />
}<br />
|
|
|
|
|
surfman19 wrote:
look for my solution:
Excuse you... Is that an order?
I don't get paid enough to fix other peoples code on command. You look for your solution - We help. Besides, I already gave it to you, if you would have bothered to read it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm wondering how I can go about making a property list sorta like the one found in Visual Studio .NET. The way VS handles properties for Windows Forms is exactly what I need for a project I'm working on. Can anyone point me in the right direction to find out some more information on how to make this sort of thing?
Bungo!
|
|
|
|
|
|
I have a program that creates graphs which you can save and load.
I have successfully associated my icon to my program so that when I click on a graph file it opens the program ( in registry ie. "c:\...\...\program.exe "%1"") however it does not load my graph I use the open file dialog do I need to write specific open file code?? Any thoughts would be great.
Cheers*
Debs*
|
|
|
|
|
If you already associated your file type to your program
So did you handle the file path passed in main function?
ie the file you opened passed as command line argument to your program so you need to handle this issue
If you not associated your file type to your program by
using window explore or when you create setup project
use File Types Editor to do it
MCAD
-- modified at 15:30 Wednesday 31st August, 2005
|
|
|
|
|
hmm ok thanks for some direction, I don't think I handle command line arguments from windows ... I'll have to read up on this any suggestions?
Debs
|
|
|
|
|
How do I do to play a raw data?
Like the data that's in the data chunk in a wav file.
The other values could I fix later.
Niklas Ulvinge aka IDK
|
|
|
|
|
Please tell me how to implement a method that will look to its own class and return (eg. an array) of all members of this class (its suppose to use reflection, this kind of reflection is called 'self' if I remember good...)
I tried something like that:
<br />
ble b = new ble();<br />
<br />
Type t;<br />
FieldInfo[] mi;<br />
t = typeof(ble);<br />
mi = t.GetMembers();<br />
<br />
foreach(MemberInfo mem in mi)<br />
this.listBox.Items.Add(mem.Name);<br />
<br />
and it wrote some strange stuff... I just want to have all the members of 'ble' class (eg. string s, int i, etc)
|
|
|
|
|
Hello
Suppose we have the next class:
class A
{
public int memberVariable;
public void Method1() {}
public void Method2() {}
}
And the next code somewhere:
Type type = typeof(A);
MemberInfo[] mis = type.GetMembers();
foreach (MemberInfo mi in mis)
{
System.Diagnostics.Debug.WriteLine(mi.Name);
}
So, we'll get something like this in output window:
memberVariable<br />
GetHashCode<br />
Equals<br />
ToString<br />
Method1<br />
Method2<br />
GetType<br />
.ctor
What is wrong? You have all your own members and inherited members.
Andrew
|
|
|
|
|
My variables were private... there is no way ti display them?
|
|
|
|
|
try
type.GetMembers(
BindingFlags.NonPublic|
BindingFlags.Instance|
BindingFlags.Static
);
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|