|
Whem i compile the code you suggest i use, I get this error:
Cannot convert method group 'Peek' to non-delegate type 'bool'. Did you intend to invoke the method? The code looks like this:
System.Diagnostics.Process p2 = new System.Diagnostics.Process();
StreamWriter sw2;
StreamReader sr2;
StreamReader err2;
System.Diagnostics.ProcessStartInfo psI2 = new System.Diagnostics.ProcessStartInfo("POINT");
psI2.UseShellExecute = false;
psI2.RedirectStandardInput = true;
psI2.RedirectStandardOutput = true;
psI2.RedirectStandardError = true;
psI2.CreateNoWindow = true;
psI2.Arguments = "/K" + compilePon;
p2.StartInfo = psI2;
p2.Start();
sw2 = p2.StandardInput;
sr2 = p2.StandardOutput;
err2 = p2.StandardError;
while (sr2.Peek < -1)
{
textBox3.Text += sr2.ReadLine() + Environment.NewLine;
}
sw2.AutoFlush = true;
p2.WaitForExit();
sw2.Close();
}
|
|
|
|
|
Well, I see two mistakes. The sign in the while statement is backwards and there are no parenthesis after the Peek call. All method calls in C# require parenthesis after the method name, evem if you're not passing in any parameters:
p2.Start();
sw2 = p2.StandardInput;
sr2 = p2.StandardOutput;
err2 = p2.StandardError;
while (sr2.Peek() > -1)
{
textBox3.Text += sr2.ReadLine() + Environment.NewLine;
}
I see I left the parenthesis out of the C# code I posted. That's what I get for converting code by hand!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 8:17 Sunday 12th February, 2006
|
|
|
|
|
I have a custom object that inherits from CollectionBase and it does not successfully bind to GridViews or DropdownLists. My understanding is that that is because GridViews and Dropdownlists implement IEnumerable, therefore, if I want my custom object to bind to the gridview or the dropdownlist, I need to inherit from IEnumerable also, right?
Whatever the answer is, I'm trying to learn what I need to do to get my custom object to bind to a gridview and a dropdownlist.
I don't think this has anything to do with it, but I'm setting the value of a Profile object (ASP.NET 2.0) equal to the custom object.
School.Teachers tlTeachers = new School.Teachers();
tlTeachers.Add(new School.Teacher("Buck"));
Profile.Teachers = tlTeachers;
Code like this works:
Label1.Text = Profile.Teachers.Count.ToString(); // The number of items in the profile object
Label1.Text = Profile.Teachers[1].FirstName.ToString();// The value of an item at a particular index position
But this does not:
GridView1.DataSource = Profile["Teachers"]; // Populate the GridView1 from the Profile Object
GridView1.DataBind();
|
|
|
|
|
Hi,
When there is key down event, the selecteditem of the treeview will change to the first treenode with the text starts with the key pressed.
Does anyone know how to disable this function?
Thanks.
coby
..
|
|
|
|
|
Do something like this:
private void treeView1_KeyDown(object sender, KeyEventArgs e)
{
e.SuppressKeyPress = true;
} This does not interfere with editing the label for nodes.
|
|
|
|
|
Thanks.
There is no such property of KeyEventArgs for C#'s KeyDown. Could you please explain to me more?
|
|
|
|
|
There is in .net 2.0.
What is the proper argument for KeyDown in .net 1?
|
|
|
|
|
This should be a new feature of .net 2.0.
Only below in .net 1.1 for KeyEventArg.
Alt
Control
Equals
GetHashCode
GetType
Handled
KeyCode
KeyData
KeyValue
Modifiers
Shift
ToString
Thanks.
coby
|
|
|
|
|
Extend the Treeview class and override WndProc. If a key is pressed, ignore it.
public class NewView : TreeView
{
private bool mAllowJumpToNode = false;
public bool AllowJumpToNode
{
get
{
return mAllowJumpToNode;
}
set
{
mAllowJumpToNode = value;
}
}
public NewView()
{
}
public NewView(IContainer container) : this()
{
container.Add(this);
}
protected override void WndProc(ref Message m)
{
if (!mAllowJumpToNode)
{
if (m.Msg < 0x0100 || m.Msg > 0x0102)
{
base.WndProc(ref m);
}
}
else
{
base.WndProc(ref m);
}
}
}
-- modified at 2:53 Friday 10th February, 2006
|
|
|
|
|
Thanks a lot. This does block all the keydown message. What should I do if I want to append the key to the end the of the selecteditem?
|
|
|
|
|
How do I create a DLL with C# I have searched google and codeproject, but they both find articles that just say "DLL" once in the article(that is what i cearch engine does).
Thanks for any and all help!
|
|
|
|
|
In the project property either use class library or use the class library template while opening a new project.
|
|
|
|
|
Create a Class Library project. This will create a .NET Framework Assembly though. C#, or any other Managed language, can't make a .DLL that exports library functions like C++ can. The .NET Framework doesn't support C-style exports.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So how do I use the files I create, any references, and thanks that will help a lot.
|
|
|
|
|
You Can use them by adding a reference to your DLL.
Thanks and Regards
Pani
|
|
|
|
|
Yes, the project will create a .dll file when being referenced.
|
|
|
|
|
There are two ways that your class library can be used:
1) The 'safest' way is to create your class library project/solution, write your code, compile it as a dll, then copy that into the /obj directory of any project that will use it. Then add reference, browse to the obj directory and add a using statement for your library namespace.
2) You add the class library project to the solution that will consume your project. This is only best if this is the only solution that would use that class library. In this method you would do an Add Reference, click the Project tab, then select your class library project and add it.
It is highly suggested that you modify your AssemblyInfo.cs file and make the version number something like "1.0.0". This way you control the version number of your dll with each release. Otherwise you create a new copy of your dll even if it is a minor implementation change.
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
In my database I have my primary key automatically assigned (it's a PO number). In my app if I cancel a new row insert then add a new row....it will keep reassigning a new pkey. However when I update the datasource it gives it hte proper p-key.....how can I get the cm to show the right key all the time?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
I can implement MC++ interfaces in many other C# projects but not in my addin project, the error is: COM interop can not find a type library for the C++ interface project.
Anyone knows why this happend?
Dilly
|
|
|
|
|
and a poor question: how can I do this?---"compile with: /clr".
|
|
|
|
|
Is the C++ code native? Are you using MC++ (.NET Framework 1.1) or C++/CLI (.NET Framework 2.0)?
|
|
|
|
|
MC++ like this:
__gc __interface IA
{
}
|
|
|
|
|
Hello,
I'm trying to int.Parse a percentage value. Using the NumberStyles parameter I can parse a currency value with currency sign and commas and everything, but there's no enumeration item for percentages. Looking into NumberFormatInfo, I can see that the percentage sign can vary between cultures.
Does anyone know of the good way to parse a percentage string? I don't want to just remove the sign at the end (that seems dirty )
Thanks!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
I am working on this project, when I add items to a drop down list using a list item it wont into the event handler on selectedindexchanged. However, use the other definition for the dropdown to add in items via a string, it actually goes into the event handler on selected index changed, for example when I do this:
<br />
ListItem item = new ListItem("One","1");<br />
DropDownList1 = new DropDownList();<br />
DropDownList1.Items.Add(item);<br />
<br />
it will add it in, but when I select something different it wont go into the event handler, but when I do this:
<br />
<br />
DropDownList1 = new DropDownList();<br />
DropDownList1.Items.Add("One");<br />
it will go into the event handler. I dont understand why this is.
|
|
|
|
|
Make sure "AutoPostBack" is set to "true" and the "SelectedIndexChange" event is actually pointing to your event handler before testing your application. Sometimes when you move or modify your control, it resets everything back to its default settings. Also, unless you are creating a DropDownList dynamically, don't initialize it. This action will also reset it back to its original default settings.
|
|
|
|