|
not that easy
something like this would work
static MethodInfo trkpmnu = null;
...
Assembly ass = Assembly.Load(filename);
foreach (Type t in ass.GetTypes())
{
if (t.Name == "SafeNativeMethods")
{
trkpmnu = t.GetMethod("TrackPopupMenuEx",
BindingFlags.Static | BindingFlags.NonPublic);
break;
}
}
...
object result = trkpmnu.Invoke(null, args[]);
<a TITLE="See my user info" href=http:
|
|
|
|
|
Is it possible to run JavaScript from a windows form?
If so, how do I do it? Maybe I'm missing something, but I haven't found an easy way to do it.
If not, is there an easy way to manipulate IE using .Net?
I'm trying to interface to an online component that is written in JavaScript using a windows form. The JavaScript calls return info about a video server and I need to get the info for the windows app.
Thanks
~ D
|
|
|
|
|
I'm not sure what is wrong with my setup but I can't generate a dataset class of the following schema
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema id="dccollection" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns="http://diglib.auburn.edu/schemas/dccollection/"
targetNamespace="http://diglib.auburn.edu/schemas/dccollection/"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://purl.org/dc/elements/1.1/" schemaLocation="dc.xsd" />
<xs:element name="record" type="dc:elementContainer" />
<xs:element name="dccollection">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element ref="record"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
I always get a error CS0542: 'dccollection': member names cannot be the same as their enclosing types
Can anyone else build a typed dataset without compile errors of this schema?
|
|
|
|
|
Jarrett Vance wrote:
I always get a error CS0542: 'dccollection':
Either rename the container or the element....
<a TITLE="See my user info" href=http:
|
|
|
|
|
i am using a mouse move message handler which is passing in System.Windows.Forms.MouseEventArgs e .. the problem is that e.X and e.Y are both relative to the current control which is calling the message handler..
how can i get the mouse position relative to the entire screen, not the control thats calling it? something like clienttorect or something?
thanks!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
See Control.PointToClient and Control.PointToScreen (there's also variants of those for Rectange s).
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
Hello All,
Im actually looking for some general suggestions. I am suppose to edit a datagrid control that has been prepopulated. When I say prepopulated, I mean that we use this third party tool that binds to the datagrid. Here are my problems:
1. Is it possible to get a collection of the column objects at runtime?
2. Can I reorded the columns at runtime?
3. Can I rename the column headings?
It looks like all of these things are fairly simple to do, through the DataGrid.TableStyles object. But I really don't have much to work with other than the grid, because of the binding to the third party control. I guess if someone could direct me on how I can get and edit the columns collection of the datagrid I would be greatly appreciative.
Thanks,
Ryan
|
|
|
|
|
for questions see System.Windows.Forms.DataGridTableStyle and DataGridColumnStyle, this two things are grid properties so you don't have to knoe the source (if the source edit TableStyles then you are in trouble)
if you don't have the Datatable to which the grid is binded you don't have any direct way to find the columns.
From Greece:
Dimitris Iliopoulos
dimilio@yahoo.com
|
|
|
|
|
This is probably an easy thing to do, but I can't figure out the syntax to save my life.
I'm clicking a button on FormRed to launch a Dialog that will enter a new number to be added to a combobox on Form Red. I can Add it to the database from that launched Dialog, but when it closes, I can't get the parent Form Red to refresh, it appears if I close and re-open it though.
What kind of syntax am I missing to make this work?
Thanks!
private void buttNew_Click(object sender, System.EventArgs e)
{
frmCreateProblemReport cpr = new frmCreateProblemReport(this.conns);
cpr.ShowDialog();
cmbPRNumber.Refresh();
}
|
|
|
|
|
once you come back from the dialog you need to call whatever function you have which populates your combobox with values from your database..
something like:
private void buttNew_Click(object sender, System.EventArgs e)
{
frmCreateProblemReport cpr = new frmCreateProblemReport(this.conns);
if (cpr.ShowDialog() == DialogResult.OK)
PopulateComboBox();
}
just make sure that since you are populating the combobox multiple times that the PopulateComboBox() function begins with:
cmbPRNumber.Items.Clear()
just because you call a dialog and you know what you want it to do with the data entered doesnt mean your other form will instantly reload everything.. you have to tell it to.. hope that helps..
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
ROCK.
Thanks dz, that was it. Piece of cake.
|
|
|
|
|
Sorry if this seems like too simple of a question for most people but . . .
I have a project with multiple classes and when I go to add that projects DLL to the tool box (so that it can be used in another project) its adds all the classes/controls in that DLL which is not necessarily what I want. I know that there is a way to set whether a class is visible in the tool box or not but I just can't seem to find the proper syntax anywhere. I know its something like:
<br />
[System.ToolBox.Visible = false]<br />
public class MyClass : System.Windows.Forms.Controls<br />
{<br />
public MyClass()<br />
{<br />
}<br />
}<br />
Any help you could give me would be truly appreciated.
Cheers
Mike
|
|
|
|
|
In MFC/C++, the function TrackPopupMenu() allows you to position the menu ( Right/Left/Centered ) with respect to the right mouse click position.
Whereas the ContextMenu.Show doesnt have any such option. If anyone knows how to do this stuff in C#, please send me the details?
VenkataSundaram
Bangalore
|
|
|
|
|
Hi Venkat,
Try using
public static bool TrackPopupMenuEx(HandleRef hmenu, int fuFlags, int x, int y, HandleRef hwnd, TPMPARAMS tpm);
this is found in Windows.Forms.SafeNativeMethods, but this thing is not documented.
However you can try achieving the same through interop.
Cheers,
Kannan
|
|
|
|
|
I found a lot of things about calling applications and Documents from C# very simple. But I did not find documentations about Calling simple DOS Commands line "md NewDire" or "Copy *.* to x:" from C#.
So I would be happy if somebody could tell me how I can use simple DOS Commands from C#.
I need the following commands: md, copy *.prg
Thanks
Stefan
|
|
|
|
|
Have you tried Process.Start with "Cmd.exe /C CommandToRun"?
Why not just use the .NET file management for these such as "File.Copy" or "Directoy.CreateDirectory"?
Rocky Moore <><
|
|
|
|
|
Thank you! You answered exactly what I wanted.
Process Start Cmd.exe : Did not see this solution.
File.Copy, Directory.Create : simple, I just did not find it in the help doc.
Thank you!
Stefan
|
|
|
|
|
How can I colour (and set boldness and such things) individual charaters in a RichTextBox?
I did this back in VB6 using the SelectionX parameters (they changed the text under selection, not the selection itself as it does in C#), but I can't find anything to do the same thing in C#.
|
|
|
|
|
here ya go this should get you started off :
VB:
<font color="blue">Private</font> void button4_Click(<font color="blue">Object</font> sender, System.EventArgs e)
{
richTextBox1.SelectionStart=richTextBox1.Text.Length;
richTextBox1.SelectionColor=Color.Blue;
richTextBox1.SelectionFont=new Font("Tahoma",10,FontStyle.Bold);
richTextBox1.SelectedText="testing blue bold\n";
<font color="DarkGreen">
richTextBox1.SelectionStart=richTextBox1.Text.Length;
richTextBox1.SelectionColor=Color.Red;
richTextBox1.SelectionFont=new Font("Verdana",10,FontStyle.Regular);
richTextBox1.SelectedText="now testing in red\n";
}
hope that helps a little
<font color="blue">Private void</font> ExpectingTwins(<font color="blue">string</font> twins)
{
<font color="blue">switch</font>(twins)
{
<font color="blue">Case</font> ("twins on the way"):
MessageBox.Show("for mr and mrs dynamic","twins on the way");
<font color="blue">break</font>;
}
}
|
|
|
|
|
Thanks! Exactly what I needed
|
|
|
|
|
For example,when mouse moves over the webbrowser's client area,a MouseOver event will be fired.
Thanks,a lot.;)
|
|
|
|
|
I recently got my hands on Visual Studio.net and it came with C#. Now, I've been using C++ for a while now, and am starting to get into the nitty gritty of windows programming (using GDI, not MFC) and I wanted to know if I should learn C# instead. I mean, I plan on learning some C#, but is C++ still more powerful? I've looked for articles on the subject, but I really wanted to hear some people's oppinions. What do you guys think? Is C# as clean as C++? Is it as powerful? As fast?
Thanks for your input!
-untwisted
-untwisted
www.uber-ware.com
brian@uber-ware.com
|
|
|
|
|
C# is not as fast, and takes more memory. (I look forward to the day that they optimize IL and C#.) It is not as powerful in some ways, but it is more powerful in others. It does a lot of the tedious and slow work for you, freeing your time for other aspects of development. The syntax is the same as in C++, which is a big plus. It is just as clean as C++, if not more so.
As for me, I'm hooked! I love C#. I'm someone who has a lot of ideas, but not nearly enough time in comparison to the number of ideas, so I really like the time that C# saves me, especially since I don't have MFC/ATL/WTL, etc.
Here is a short feature comparison:
operator overloading Y/Y
method overloading Y/Y
single inheritance
multiple inheritance Y/N (coming in 2.0)
templates Y/N (coming in 2.0)
pointers Y/Y(unsafe only)
new keyword can explicitly hide/replace inherited member N/Y
delegates N/Y
foreach iterator N/Y
case fallthrough in switch statement Y/N
bit fields Y/N
default values in method parameters Y/N
And here is an MSDN article that may help you.
[^]
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Much thanks! That helps a lot. No one would give me a sure answer on weather or not it was faster, etc. Is there any way in C# to get to the bare bones of programming though? If I wanted to could I create a windows application from scratch using windows GDI? What makes C# slower? What I'm getting at I guess is this: Can C# be a replacement language for C++? I realize that the little drag and drop of C# must make it slower, and add overhead to your project, but if I wanted to could I skip that? Can I make my code just as fast and clean and efficient in C# as in C++? Sorry if I'm being redundant, but I'm having a hard time explaining my question. It's late here, I think I need some sleep
Thanks again!
-Brian
-untwisted
www.uber-ware.com
brian@uber-ware.com
|
|
|
|
|
untwisted wrote:
If I wanted to could I create a windows application from scratch using windows GDI?
Yes, you could, but you probably wouldn't see a really noticable speed increase.
untwisted wrote:
What makes C# slower?
It's managed, and it seems that MS put hardly any effort into optimizing MSIL. I'd really like to see them do that - it would make a big difference (and I believe they are planning to, but the question is: when?). If they optimized IL, all .NET languages would benefit from the speed boost. It's not like C# code runs at a snail's pace, but nevertheless, the difference between C++ speed and C# speed is noticable.
untwisted wrote:
Can C# be a replacement language for C++?
Yes, it can - in fact it can be an improvement over C++, if you don't mind the speed drop. With .NET Windows Forms, the problem seems to be GDI+, which is not hardware-accelerated (this will be fixed in v2.0).
That huge class library is a timesaver 100x over.
Having said this, I, for my part, will still continue to use C# as my main development platform.
If you really want speed and .NET together, try Managed C++. It's not as easy as C#, but it gives you that extra speed edge.
BTW, sorry if I confused you in the last post - in the comparison list, the left Y/N is C++ and the right Y/N is C#. Also, I forgot to say - C# and C++ support single inheritance.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|