|
|
Hello,
how can i avoid, that my Control (AutoScroll=true) everytime scrolls to the Coordinate (0,0) if it is repainting? I've tried it to save the actual Vertical and Horizontal Scroll-Value in a Variable, and after repainting, i set the Scrollbars to that value. But the problem is the Scrollbars doesnt jump to the right position, i see the controls correctly, but the scrollbars (the "really" visible scrollbars) doesnt change.
Can somebody help me?
|
|
|
|
|
Hi,
I am developing an application in C# that will retreive an email based on some search criteria in the subject line from a mail account and forward the retrived mail to different receipients along with a new a message on top of the forwarded mail.
How can i achieve below functionality in C#?
- How can i retrive a mail based on some search criteria?
- How the mail can be forwarded to other receipients along with the new message on top of that?
Kindly revert for any clarifications.
Thanks in advance.
Praveen Raghuvanshi
Software Engineer,
India.
|
|
|
|
|
praveen raghuvanshi wrote: How can i retrive a mail based on some search criteria?
Depends on what mail server you have. CP has an article[^] on getting mails from POP3.
praveen raghuvanshi wrote: How the mail can be forwarded to other receipients along with the new message on top of that?
Create a new mail message, append the existing message also to it's message body.
|
|
|
|
|
Thanks..
I tried the method described in the link provided earlier.
There is a table in the message which i want to forward.
I am not able to get the table in the table format in the body part of message. So when I forwards the message, table elements get displayed in the message and not the whole table in the tabular form.
Kindly advice to forward a table in the table format along with the text message.
Praveen Raghuvanshi
Software Engineer,
India.
|
|
|
|
|
I have a set of classes in an assembley.In each class there are certain methods.when I select assembly it should display all the classes in the grid view .when I select a class in the gird view it should expand the gridview and should display all the methods in the grid view as separate rows.
I am able to display classes in the grid view .when I select a class I am not able to expand the gridview to display the methods as extra rows.
I am able to display methods in separate a gridview ,but not in the same grid view.
please help in how to expand or collapse gridview to display classes/methods information in an assembly
Thanks for any help
|
|
|
|
|
Please post your code
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
This is the code i have written to display class/method details in separate grid views.
private void dllPathTextBox_TextChanged(object sender, EventArgs e)
{
int id = 1;
DataSet dataSet = new DataSet();
classesSummaryTable = new DataTable("ClassesSummary");
classesSummaryTable.Columns.Add("ID", typeof(int));
classesSummaryTable.Columns.Add("TypeName", typeof(Type));
classesSummaryTable.Columns.Add("Summary", typeof(string));
methodsSummaryTable = new DataTable("MethodsSummary");
methodsSummaryTable.Columns.Add("ID", typeof(int));
methodsSummaryTable.Columns.Add("MethodName", typeof(string));
methodsSummaryTable.Columns.Add("Summary", typeof(string));
Assembly asm = Assembly.LoadFrom(this.dllPathTextBox.Text);
Type[] classes = asm.GetTypes();
foreach (Type type in classes)
{
DataRow classSummaryRow = classesSummaryTable.NewRow();
classSummaryRow["ID"] = id;
classSummaryRow["TypeName"] = type;
string comment = new XmlComments(type).Summary.InnerText;
if (comment == "")
classSummaryRow["Summary"] = "No Summary For This";
else
classSummaryRow["Summary"] = comment;
classesSummaryTable.Rows.Add(classSummaryRow);
MethodInfo[] mi = type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic);
foreach (MethodInfo methodInfo in mi)
{
DataRow methodsSummaryRow = methodsSummaryTable.NewRow();
methodsSummaryRow["ID"] = id;
methodsSummaryRow["MethodName"] = methodInfo.ToString();
string comment1 = new XmlComments(methodInfo).Summary.InnerText;
if (comment1 == "")
{
methodsSummaryRow["Summary"] = "No Summary For This";
}
else
{
methodsSummaryRow["Summary"] = comment1;
}
methodsSummaryTable.Rows.Add(methodsSummaryRow);
}
id++;
}
dataSet.Tables.Add(classesSummaryTable);
dataSet.Tables.Add(methodsSummaryTable);
DataRelation relation = new DataRelation("MethodsOfCLass",
dataSet.Tables["ClassesSummary"].Columns["ID"],
dataSet.Tables["MethodsSummary"].Columns["ID"]);
dataSet.Relations.Add(relation);
classesSummaryBindingSource.DataSource = dataSet;
classesSummaryBindingSource.DataMember = "ClassesSummary";
methodsSummaryBindingSource.DataSource = classesSummaryBindingSource;
methodsSummaryBindingSource.DataMember = "MethodsOfCLass";
}
I am binding that two binding source objects to two separate grid views to display in different gridviews.
This is the code i have written to display class/methods details in separate grid views.But i need to display in only one gridview.First i need to display only classes information.when user selects any particular class row then grid should be expanded and should display method information in the same gridview as separate rows.when user again selects the same class row gridview should be collapsed.
thanks for your response
|
|
|
|
|
Hey,
I'm trying to become familiar with programming with DirectX and I've got the graphics part working but for some reason MouseState.X and MouseState.Y always return 0;
My current setup is:
private Device mouse;
// initialization
mouse = new Microsoft.DirectX.DirectInput.Device(SystemGuid.Mouse);
mouse.SetCooperativeLevel(this, Microsoft.DirectX.DirectInput.CooperativeLevelFlags.Background | Microsoft.DirectX.DirectInput.CooperativeLevelFlags.NonExclusive);
mouse.Acquire();
// Use
MouseState ms = mouse.CurrentMouseState;
Console.WriteLine("Mouse1 is down Point: {0}, {1}", ms.X, ms.Y);
The events for the mouse are working, it correctly detects when mouse 1 and mouse 2 are pressed, but ms.X and ms.Y are always 0. Anyone know what I'm doing wrong?
|
|
|
|
|
I need to get the network drives so I have chased through from the CreateObject in VB to ManagementClass C#. I snaffled the following code from MSDN
using System;<br />
using System.Management;<br />
<br />
class Sample_ManagementClass<br />
{<br />
public static int Main(string[] args)<br />
{ <br />
ManagementClass diskClass = new ManagementClass("Win32_LogicalDisk");<br />
diskClass.Get();<br />
Console.WriteLine("Logical Disk class has " + diskClass.Properties.Count + " properties");<br />
return 0;<br />
}<br />
}
My problem is System.Management does not have a ManagementClass it only has Instrumentation.
I am using VS2008
Any ideas on how to reference to the ManagementClass
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: I need to get the network drives
You need to query using ManagementObjectSearcher[^] class. This[^] shows an example.
Hope it helps
|
|
|
|
|
You need to add the REFERENCE for System.Management - Aaaahhhhh.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello everyone,
Sometimes I saw code which does not store reflection data structure MethodInfo, but stores MethodHandle each time and converts MethodHandle to MethodInfo (using GetMethodFromHandle) when MethodInfo is used to invoke the specific method using reflection.
My understanding is,
1. Using method handle could save memory;
2. But each time doing conversion from method handle to method info uses additional time.
So, it is a memory footprint/performance trade-off of choosing method info and method handle.
My questions is whether my above understanding of whether to use method handle or method info is correct. If not, what are the correct points?
thanks in advance,
George
|
|
|
|
|
Hello everyone,
There are two ways to use reflection to invoke a method,
1. Using InvokeMember;
2. Using GetType.GetMethod to retrieve a MethodInfo object, then use the MethodInfo object to invoke the method.
My point is from the result point of view, they are the same, but method 2 if more efficient if we want to invoke the method multiple of times by the same MethodInfo object -- since each time we call InvokeMember, it needs to find the method, nothing saved as MethodInfo object in method 2 and each time InvokeMember did the binding to find the same method.
My question is whether my point of understanding is correct and whether there any more differences/pros/cons compared with the 2 methods.
thanks in advance,
George
|
|
|
|
|
Sounds reasonable to me. I never use InvokeMember.
|
|
|
|
|
Thanks PIEBALDconsult,
regards,
George
|
|
|
|
|
George_George wrote: My question is whether my point of understanding is correct and whether there any more differences/pros/cons compared with the 2 methods.
Looks like your understanding are correct.
If you know the method signature at compile time, you can gain more performance by creating a delegate from the MethodInfo using Delegate.CreateDelegate(Type, MethodInfo)[^] and invoking that delegate.
|
|
|
|
|
Thanks N a v a n e e t h,
Looks like it could only deal with static method?
regards,
George
|
|
|
|
|
George_George wrote: Looks like it could only deal with static method?
MSDN
In the .NET Framework version 1.0 and 1.1, this method overload creates delegates for static methods only. In the .NET Framework version 2.0, this method overload also can create open instance method delegates; that is, delegates that explicitly supply the hidden first argument of instance methods. For a detailed explanation, see the more general CreateDelegate(Type, Object, MethodInfo) method overload, which allows you to create all combinations of open or closed delegates for instance or static methods, and optionally to specify a first argument.
See in the remarks
|
|
|
|
|
Thanks N a v a n e e t h,
1.
I am interested in the method of using CreateDelegate you mentioned here. But I am confused why it could improve performance, since you still need to create MethodInfo, and what are the differences internally compared with GetType.GetMethod.Invoke? Is it because GetType.GetMethod.Invoke binds at runtime but CreateDelegate binds at compile time, so CreateDelegate is faster?
2.
But if it is the compile time/runtime binds performance differences, my confusion is the reason of why using relfection is beause we do not know the type until runtime, does compiler time binding really practical even if it saves performance? Any comments?
regards,
George
|
|
|
|
|
1 - I do not know why it improves performance. I have used it and found the difference. Here[^] is a blog post which also explains it.
2 - There are situations where you know the signature of the method to invoke. The above given blog post explains how to handle when it is unknown.
|
|
|
|
|
Thanks N a v a n e e t h,
N a v a n e e t h wrote: There are situations where you know the signature of the method to invoke
From my study, I think not only signature but also the Type name is needed. Correct?
regards,
George
|
|
|
|
|
Hi N a v a n e e t h,
I read the article for quite some time, but confused about what means group method and extension method. I did some search and can not find any comprehensive materials covering this.
Do you have any referred documents for the 2 concepts?
regards,
George
|
|
|
|
|
I found out that the items under the menu strip can have a short cut key.. now i want a short cut key for my tool bars or some other components.. so what i did was to enable the key preview of the form then on the key down event, i tried to capture the keys.. but the problem is it only accepts one key at a time.. what if i press two keys like control + s or control + 0... how do i capture those combination?
|
|
|
|
|
When you check what key has been pressed, you can also check if any special keys are also pressed (like Ctrl, Shift) So to check for Ctrl+F:
void myEvent(object sender, EventArgs e)
{
if(e.Key == F && e.Ctrl)
{
}
}
Or err, something like that anyway.
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|