|
I've tried to access the nodes by indexes (not through enumeration) - doesn't help much.
Ran the profiler on mshtml.dll too, and it showed that most time is spent on accessing the attributes and children of nodes.
Thus there's only one possible reason - either .NET works slowly when accessing mshtml elements, either the mshtml is generated wrong (which I doubt).
|
|
|
|
|
This is the C# code that I used for tests (doc is a HTMLDocument variable):
ArrayList nodes=new ArrayList();
mshtml.IHTMLDOMNode nod;
children=(mshtml.IHTMLDOMChildrenCollection)doc.childNodes;
foreach(mshtml.IHTMLDOMNode node in children) nodes.Add(node);
mshtml.IHTMLAttributeCollection attributes;
for(int a=0;a
|
|
|
|
|
How can I write a prog to Pop up a message box notifying me about an meeting ,refering to the calander of the outlook, half an hour before meeting.
Also I want the system to take data from Data Base connected to the Outlook and send me an SMS 30 mins before meeting..............
Can you help me out please.......
Thanx And Regards
Arjo
Arjo Gupta
|
|
|
|
|
Use the Outlook interop dlls to interop with Outlook and retieve Outlook data. See the MSDN article here[^] for further information.
|
|
|
|
|
I have did a program such that , i will have two text box name and age in my form..and a button..so that when the values entered r in the text box..a xml file is created with those data...
and my coding is as follows.
Inside the burtton click, th e coding is as follows
//create a dataset
DataSet dataSet = new DataSet();
//read the schema
dataSet.ReadXmlSchema("d:\\Menu.xsd");
//create a new row
DataRow newrow;
newrow = dataSet.Tables[0].NewRow();
//enter the values
newrow[0] = Convert.ToInt32(txtName.Text);
newrow[1] = Convert.ToInt32(txtAge.Text);
//add the row to the dataset
dataSet.Tables[0].Rows.Add(newrow);
//write the data to a xml file
dataSet.WriteXml("D:\\myData.xml", XmlWriteMode.WriteSchema);
MessageBox.Show("saved");
Now i have one doubt..
ie, the program which i did ..now ..in the form...when i am giving data as
for
name: john
age:22...
now myData.xml wil be saved with those data ... Now if i am clearing those vaues in th textbox and adding some other data... that should be added without deleting the previous data... and also if i am entering again john..it should show that already it exists....
please say how to do this...
|
|
|
|
|
Before writing to the XML file, read the existing one into a DataSet. Before writing a new name & age to the XML file, first make sure its not in the dataset. If it is, show a box saying it already exists.
That said, if you're going to be storing lots & lots of data like this, I recommend you use a database rather than XML files. XML files are good for configuration, settings, storing discreet, concise bits of information in a human readable format. If that's not what your goals are, you should choose another tool such as a database to store your data.
|
|
|
|
|
Hi
I have did a program such that , i will have two text box name and age in my form..and a button named save. so that when the values entered r in the text box..a xml file is created with those data...
Now I can able to create one set of values…. No what I need is that when again some other value is entered in the textbox. It should also be written in the xml file..but without deleting the other. I mean it should append on the other..
For example: first I entered forst as john and 22 for name and age ..it will added in the xml file..no again if I enter charu and 23 as name and age..
Now xml should have john and 22 as well as charu and 23…
And also one more thing is that if I again enter John. It should give a message that it has already been entered. No values should be repeated again. Please help me to do this…..
The coding which I did is as follows.
In side the button click
//save Button
private void button1_Click(object sender, System.EventArgs e)
{
DataSet dataSet = new DataSet();
//read the schema
dataSet.ReadXmlSchema("..\\..\\PlaygroMenu.xsd");
//create a new row
DataRow oValues;
oValues = dataSet.Tables[0].NewRow();
//enter the values
oValues[0] = txtName.Text;
oValues[1] = Convert.ToInt32(txtAage.Text);
//check for duplication
bool hasalready = false;
foreach(DataRow row in dataSet.Tables[0].Rows)
{
if(row.ItemArray[0].ToString().Equals(txtID.Text))
{
hasalready = true;
}
}
//
if(!hasalready)
{
//add the row to the dataset
dataSet.Tables[0].Rows.Add(oValues);
//write the data to a xml file
dataSet.WriteXml("..\\..\\resultdata.xml", XmlWriteMode.WriteSchema);
MessageBox.Show("Saved");
}
else
{
MessageBox.Show("Already Exists");
}
}
private void Form1_Load(object sender, System.EventArgs e)
{
DataSet dataSet = new DataSet();
//read the schema
dataSet.ReadXmlSchema("..\\..\\Menu.xsd");
System.IO.FileInfo file = new System.IO.FileInfo("..\\..\\mydata.xml");
//check whethere there is result xml file...
if (file.Exists)
{
dataSet.ReadXml("..\\..\\resultdata.xml");
}
}
Please help me to do this..
Dhol
|
|
|
|
|
Hi,
I am planning to use this approach please let me know if there is a problem in this approach..
Same code can be written for C# as well..
Thanks and Best Regards,
Shahid
// This example shows how to create an Object* containing task
// information, and pass that Object* to a task queued for
// execution by the thread pool.
#include "stdafx.h"
#using
using namespace System;
using namespace System::Threading;
// TaskInfo holds state information for a task that will be
// executed by a ThreadPool thread.
public __gc class TaskInfo
{
// State information for the task. These members
// can be implemented as read-only properties, read/write
// properties with validation, and so on, as required.
public:
String* Boilerplate;
int Value;
Thread *tHandle;
// Public constructor provides an easy way to supply all
// the information needed for the task.
TaskInfo(String* text, int number)
{
Boilerplate = text;
Value = number;
tHandle=NULL;
}
};
public __gc struct Example
{
// The thread procedure performs the independent task, in this case
// formatting and printing a very simple report.
//
static void ThreadProc(Object* stateInfo)
{
try
{
//Do Always
TaskInfo *tInfo= (TaskInfo *)(stateInfo);
tInfo->tHandle = Thread::CurrentThread;
TaskInfo* ti = dynamic_cast(stateInfo);
Thread::Sleep(10000);
Console::WriteLine(ti->Boilerplate, __box(ti->Value));
}
catch(ThreadAbortException *Te)
{
Console::WriteLine(S"Thread Aborted by Main Thread{0}",Te->ToString());
}
}
};
int main()
{
try
{// Create an object containing the information needed
// for the task.
TaskInfo* ti = new TaskInfo(S"This report displays the number {0}.", 42);
// Queue the task and data.
if (ThreadPool::QueueUserWorkItem(new WaitCallback(0, Example::ThreadProc), ti))
{
Console::WriteLine(S"Main thread does some work, then sleeps.");
// If you comment out the Sleep, the main thread exits before
// the ThreadPool task has a chance to run. ThreadPool uses
// background threads, which do not keep the application
// running. (This is a simple example of a race condition.)
Thread::Sleep(1000);
//Abort the Thread started
ti->tHandle->Abort();
Thread::Sleep(15000);
Console::WriteLine(S"Main thread exits.");
}
else
{
Console::WriteLine(S"Unable to queue ThreadPool request.");
}
}
catch (...)
{
Console::WriteLine(S"Unknown Exception Occured in Main");
}
return 0;
}
;
|
|
|
|
|
I don't think aborting threadpool threads is a good idea. That apart, your code is susceptible to a race condition between assigning and using tHandle.
tInfo->tHandle = Thread::CurrentThread;
is not guaranteed to run before
ti->tHandle->Abort();
so you'll get a NullReferenceException if that happens.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
How can I implement password remembrance feature in Windows Forms Login Dialog box in a windows based application?
If anyone have code snippet to implement such kind of feature, that would be a great help..........
Thanks,
Sandeep
+919891027854
|
|
|
|
|
Write your saved settings to disk. Better yet, in Visual Studio 2005, add a .settings file to your project, which will take care of reading & writing it to disk for you.
|
|
|
|
|
It is not clear what u r specifying. I am building windows forms application with C# in Visual Studio.NET
I want to save password for the user. How can i do it? If u have a code snippet, Plz send that...
Thanks,
Sandeep
+919891027854
|
|
|
|
|
Look up application settings files in .NET 2.0. For example, here's[^] something I found simply by searching Google.
|
|
|
|
|
Hi, i have a problem about datagridview.
When i apply a sorting operation on a datagridview, it sortes the items well, but changes the selected item (not selected index). Let me explain this:
For example, my sort column's values below:
aaa (selected)
bbb
ccc
ddd
after sorting:
ddd (selected)
ccc
bbb
aaa
It changes the selected item. But i want my first selected item will stay in selected.
Does anyone know how can i do this?
Thanks.
ozgur.nevres
|
|
|
|
|
Get the item selected before sorting. After sorting, re-select that item. Would that work for you?
|
|
|
|
|
I did this. I mean, is there any way to do this automatically. A property, or something...
I think the answer is no.
Thanks for your care.
ozgur.nevres
|
|
|
|
|
|
I am stuck with this problem from past one week .
Problem definition :A form shall have a minimum size .When the user changes the width of the form ,the height must also change by the same amount .Similarly when the height of the form changes the width must change by the same amount . In the below code only the width change and its corresponding height change is implememnted . The height change is yet to be done .
My Solution :
Overriding the OnSizeChanged
//This function shallbe contained in a simple Windows form
private bool bWidthCheckSize = true;
protected override void OnSizeChanged(EventArgs e)
{
count ++ ;
base.OnSizeChanged (e);
try
{
/*When the width is changed ,proportionately the height is also changed proportionately in the second if cond . But when the height is changed this event is triggered again .Hence bWidthCheckSize is made false before changing the height . Hence when this function is triggred due to change of height it just returns back ,by resetting the bWidthCheckSize flag*/
if(bWidthCheckSize == false)
{
bWidthCheckSize = true;
return;
}
/*Though the height is updated ,the updated height is lost as the event is called by itself .Hence every time the height is updated with the previous height . This is the cause of the flickering .I am wondering is there any work around .Moreover this logic does not hold good if I put the code for handling Fom Height change .*/
this.Height = this.prevHeight;
//Form Size Changed by width ,if current width is not equal to previous width
if(prevWidth!=this.Width)
{
//Get the difference in Width
int diffInWidth = (this.Width - prevWidth);
//Update the previous width
prevWidth =this.Width;
bWidthCheckSize = false;
//Update the prevHeight by the same amount ,the height would be increased
prevHeight += diffInWidth;
//Increase the height by the same amount
this.Height += diffInWidth;
}
return;
}
catch{}
}
Thanks in Advance ,Hope to receive a earlier response
|
|
|
|
|
To prevent flickering, I suggest turning on double buffering in your form, inside your form's constructor:
public Form1()
{
...
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
}
protected override void OnPaint(PaintEventArgs args)
{
base.OnPaint(args);
}
|
|
|
|
|
Hi,
i want my application to authonticate through the windows Authontication..
meanin that if a user has entered the network domain.. i want my program to check through the active directory or whereever she needs to check , if the user is on a the list (and then he can have access to some speacical features) and if not(but still on the domain users list) to be able to access other features.
how do i accomplish this task through c#?
and if you can tell me how to configuire the active directory as well i will be grateful...
thanks YOSI
|
|
|
|
|
A simple web search is all you need: here[^].
|
|
|
|
|
In simplest terms -- i know it binds data but someone please make this make since to me
currencymanager???
thanks
|
|
|
|
|
Just a shot in the dark, but CurrencyManager is used to keep data-bound controls synchronized (current) with each other. Maybe that explains the name.
|
|
|
|
|
thanks but i need to know the logic of this class....
any articles???
or is someone able to give me a good explanation on the usage of this class
|
|
|
|
|
My application is using one registry value.Intially its value is TRUE. while Closing application the Value will be set to TRUE becoz i had handled the Close Event of application and set the Registry value to TRUE.so that when the application is open again the value should be TRUE, BUT if press i CTRL+ALT+DEL in between the running application.Close Event does not fire. Value remain FALSE in the registery value and my application does not work properly
Now my problem is where should i set the registry value to TRUE if i press CTRL+ALT+DEL in running application.
Amit Grover
CDAC R&D
|
|
|
|