|
thanks...
seems the only way is using win32 api
|
|
|
|
|
Most of the .NET classes use the Windows API - they're just wrappers.
"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
|
|
|
|
|
Hi,
I am using shdocvw/mshtml to automate IE. I'm able to create an instance of IE, retrieve a document, and manipulate the document (i.e. fill in text fields, click buttons, etc).
The problem I'm having though, is working with pages that have frames. I am getting the top level page, and cannot seem to access any of the frames themselves. When I try calling the property .frames off my document, I get the error:
An unhandled exception of type 'System.InvalidCastException' occurred in UIAutomation.exe. Additional information: No such interface supported.
Does anyone know why this is? Maybe I'm assigning it improperly? When I enumerate through .all, I do see the frameset and frame elements. This problem happens on even simple pages such as:
http://www.htmlcodetutorial.com/frames/basicframeset.html
Thanks.
|
|
|
|
|
Can DateTime.Now display millaseconds?
I have...
DateTime.Now.ToString("hh:mm:ss");
what abrevation do I put in for millaseconds?
/\ |_ E X E GG
|
|
|
|
|
Vb.Net:
<font color="blue">Private</font> <font color="blue">Sub</font> Button1_Click(<font color="blue">ByVal</font> sender <font color="blue">As</font> System.Object, <font color="blue">ByVal</font> e <font color="blue">As</font> System.EventArgs) <font color="blue">Handles</font> Button1.Click <br> MessageBox.Show(<font color="#0000FF">DateAndTime</font>.Now.Ticks) <br> <font color="blue">End</font> <font color="blue">Sub</font> <br>
Vb:
<font color="blue">Public Function</font> TwinsOnWay(<font color="blue">ByVal</font> twins <font color="blue">As String</font>) <font color="blue">As String <br> Select Case</font> twins<br> <font color="blue">Case</font> "Gender" <br> <font color="blue">Return</font> "Two Girls" <br> <font color="blue">End Select <br> End Function</font> <br>
|
|
|
|
|
might help if it's C# code lol :
C#:
<font color="blue">private</font> <font color="blue">void</font> button4_Click(<font color="blue">object</font> sender, System.EventArgs e) <br> { <br> MessageBox.Show(<font color="#0000FF">DateTime</font>.Now.Ticks.ToString()); <br> } <br>
there ya go
Vb:
<font color="blue">Public Function</font> TwinsOnWay(<font color="blue">ByVal</font> twins <font color="blue">As String</font>) <font color="blue">As String <br> Select Case</font> twins<br> <font color="blue">Case</font> "Gender" <br> <font color="blue">Return</font> "Two Girls" <br> <font color="blue">End Select <br> End Function</font> <br>
|
|
|
|
|
ok...
is that in milla seconds? or nano seconds???
and I need it to look like this minutes:seconds:millaseconds...
so, DateTime.Now.ToString("mm:ss:??");
how would I do that?
/\ |_ E X E GG
|
|
|
|
|
You might look at:
DateTime.Now.ToString("mm:ss:fffffff");
Rocky Moore <><
|
|
|
|
|
that's exactly what I wanted.
thanks.
/\ |_ E X E GG
|
|
|
|
|
|
In the DateTime structure, one Tick always equals 100 ns (100 nanoseconds = 0.1 mikroseconds = 0.0001 milliseconds). But as you said, the actual resolution is somewhat lower.
|
|
|
|
|
I have a reporting interface that generates 100 or so reports. Each report uses a varying combination of 11 total parameters (from 0 - 4 at most). So I could have:
Report report = new Report(StartDate, EndDate, NameID, LocID) //or just
Report(StartDate, NameID) //or
Report()
My problem is: how do I get my constructor to accept the parameters and know which ones were passed without overloading it a gillion times. Is there a way to a generic type parameter and get the actual name of the parameter passed? If I have the name of the parameter I can cast to the right type. I could even create a hashtable with all my parameter names, types and build my AddParameter method off of the parameter name.
Actually If I can get the name of the parameter, and I know the most that will be passed is four, five constructors and be good to go...I think.
Is this possible?
Robert
|
|
|
|
|
Why not just pass it a collection or array that contains your "parameters".
|
|
|
|
|
Excellent idea. Obviously never thought of it.
|
|
|
|
|
Besides albean suggestion, which makes it very flexible for extending parameters, you can always set properties of a class and pass this class as a parameter to your Report constructor.
Acting as a substitute for God, he becomes a dispenser of justice. - Alexandre Dumas
|
|
|
|
|
Martin Fowler had a solution for this type of problem in Refactoring with Introduce Parameter Object (p. 295). The concept is to "Create a new class to represent the group of parameters you are replacing."
ReportParams rp = new ReportParams (StartDate, EndDate, NameID, LocID);
Report report = new Report (rp);
Your new parameter object could have all the permutations of parameters and remove those details from the Report class.
α.γεεκ Fortune passes everywhere. Duke Leto Atreides
|
|
|
|
|
Off to Amazon.com I guess. Thanks for the tip.
|
|
|
|
|
Hi Yallz,
I have a list box that you can edit the items in (click a button, and it pops up a form so you enter the info you want), the problem I'm encoutering is that once the user presses OK on the edit form the listbox isn't update with the new informatin. Is there anyway to update a listbox item without removing it and then adding it back?
Thanks!
- monrobot13
|
|
|
|
|
Are you doing something like this in your click event:
MyForm f = new MyForm();
f.Show();
If you are then your problem is you are getting a NEW form each time with an empty list.
Try hiding the listbox form when you are done with it. In the button click event unhide it.
|
|
|
|
|
That's not it. I actually serialize all the listbox items when the form is closed and then deserialize them when it's loaded. When I do this it does show the new information.
When you add an item to a listbox it call's it ToString function to get the text to display. I want to update the text that is being displayed without removing and readding the item.
- monrobot13
|
|
|
|
|
Don't use ToString().
Add the item itself, or better yet use databinding to display a complete collection. When you edit the collection entry, the listbox is updated (possibly after a call to Refresh()).
|
|
|
|
|
Does anyone know what the C# WinForm equivalent is of the old VB6 DoEvents() method on forms???
This is the process where a tight loop will allow the form to process events before going back into its' loop.
Thanks!
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
Application.DoEvents(). But in many cases it's better to use multiple threads.
"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
|
|
|
|
|
Well...I have the methods I am calling broken out into a DLL. And I did find the Application.DoEvents() to be fairly non-responsive. (2 or 3 button clicks to end the process)
But I'm not really familiar with spawning threads in a WinForm client. What are the basic steps I would need to do to make the component an independant thread? Or if you know of a tuturial...?
Thanks,
MJ
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
There's sure to be one on CodeProject somewhere, but here's a brief example:
using System.Threading;
Thread thread=null;
thread=new Thread(new ThreadStart(this.ThreadMethod));
thread.IsBackground=true;
thread.Start();
Thread.Sleep(0);
"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
|
|
|
|