|
Hi all
If i create an excel range object (from a range of items e.g. A1 to C5)
this returns me a System.__ComObject
how do i turn this into a system array so i can then iterate through and strip out the individual cells.
I know i can do Range.Value2, which returns me a System.Object[,]
but then all i have access to is the values within the range so i cant grab additional cell data such as the number format information for working out the date.
any ideas?
|
|
|
|
|
just cast the return object into a Excel.Range object and you will be able to iterate through the cells that make up the range. Look for the correct methods, its easy.
You will not be able to turn it into a system array, because if you want to keep all information contained in each cell, ur better off just using directly excel's Range object which contains all the info of all the cells contained in it.
Bare in mind that excel does not have a 'Cell' class (which u would use to create ur system array). It only has the Range class and 1 unique cell is just a Range class object that spans 1 cell.
-- modified at 5:41 Thursday 9th February, 2006
|
|
|
|
|
Hello,
I was trying to force to stop a background worker's do event handler with cancelAsynch method, but it is not stopping the work. Is that possible to force to stop ?
Emran
|
|
|
|
|
emran834 wrote: Is that possible to force to stop ?
Yes, but the task executed by the BackgroundWorker needs to periodically check the CancellationPending property to determine if it needs to stop.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Hi,
thanks for reply. Ok, I understood that I will have to check the pending property, but in order to check the property, the working loop must finish its task, right ? like,
while( if cancelProperty false)
{
task....
}
Now, the task is very loong task, like sending heavy attachment emails or Playing Audio Stream, so, while loop will not check the state unless the heave task has been finished, right ? I want to FORCE to STOP that heavy task in the middle of its work. Is that possible ?
Moreover, the periodical Property Checking has another drawback which we know by Race Condition, right ?
thanks and regards
Emran
-- modified at 6:56 Thursday 9th February, 2006
|
|
|
|
|
Hi Emran,
Your task could spin off a separate thread to execute the "real" (long) task, then periodically check for cancellation. If the task needs to be cancelled, it could kill the running thread.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Thanks , thats a nice idea . I will try that,
|
|
|
|
|
where can I download FXcop SDK for visual studio 2005?
thank's
Amit
|
|
|
|
|
Hi,
Is it possible to add DLL reference in runtime ? The reason I am thinking is, I want to provide updates of my software in dll file and use will be able to include that dll file in the program folder.
Emran
|
|
|
|
|
Of course it is. You can use the Assembly class to load assemblues in runtime.
Greetings,
Ingo
------------------------------
A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
|
|
|
|
|
Hi,
Thanks for the reply. Can you show me any easy snippet for example ?
Emran
|
|
|
|
|
Hi Emran, I haven't tested this, but it looks like this may work:
bool loadAssembly
(string strDllFilename)
{
try {
Assembly.LoadAssembly (strDllFilename);
} catch (Exception) {
return (false);
}
return (true);
}
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Hello All,
I am facing a huge problem ,I am opening a DBF file .For some cases it is fine but few tables its giving errors like:-
"the Provider couldnot determine the Decimal value.For Example, the row was just created,the default for the Decimal column was not
available,and the consumer had not yet set a Decimal value"
Code snippet is :-
public DataSet GetProjectTable()
{
string strSql,strConnect;
try
{
strConnect="User ID=;DSN=;Collating Sequence=MACHINE;Data Source= '" + ngisViewer_Open.lay + "' ;Provider=VFPOLEDB.1;Cache Authentication=False;Mask Password=False;persist security info=False;Mode=Share Deny None;Extended Properties=;Encrypt Password=False";
OleDbConnection objConn = new OleDbConnection();
OleDbDataAdapter objDA= new OleDbDataAdapter();
OleDbDataAdapter objDA1= new OleDbDataAdapter();
OleDbCommand objCmd = new OleDbCommand();
objConn.ConnectionString = strConnect;
objConn.Open();
strSql = "select * from '" + ngisViewer_Open.lay_Name_Final + "' ";
objCmd.CommandText = strSql;
objCmd.Connection = objConn;
objDA.SelectCommand = objCmd;
DataColumn dc = new DataColumn("UID", typeof(int));
objDA.Fill(ds1,"MyTable");
ds1.Tables["MyTable"].Columns.Add(dc);
for(int j=0;j
|
|
|
|
|
How can I save the text from a rich text box that is generated as a new
rich text box in a tab control? The rich text box is created in a "external" class file. I want to be able to have several rich
text boxes open, and save the one that is under the selected tab.
Thanks!
|
|
|
|
|
in the tabpages there is a controlcollection where every control from this page is being contained :
With
tabpage.Controls
you can get these controls and then look for your textbox.
On the other hand you can place a reference from the tag of the tabpage to your textbox then you don't have to look it up.
Textbox textbox = new Textbox();
tabpage.Tag = textbox;
And later:
string text = ((TextBox)tabpage.Tag).Text;
Greetings,
Ingo
------------------------------
A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
|
|
|
|
|
HI all.
I hane a xml file and a xslt file, to convert them to html I use xslTransform.Transform(). It works, but only problem is that I get the message that the Transform(string, string) method is obsolute and that I should rather pass the xmlResolver to the Transform() method.
So I thought of using
XslTransform.Transform(string inputFile,string outputFile, XmlResolver resolver)
But I just can't get the resolver part right, maybe because I don't know how it works. And I understand why they would make
XslTransform.Transform(string inputFile,string outputFile)
obsolute if it works fine.
Can anyone help please.
It will come to him who waits, that is if he doesn't die of old age.
|
|
|
|
|
Hello All,
I am using datagrid to view single DBF table through OLEDB
I am not getting the desired datagrid
It comes somewhat like
-----------------------------------------------
| -->(+)
|
|
|
after clicking (+) sign it gives me table and then opens it
I have one table only
I want table to be displayed directly no (+) sign and all
Thanks and Regards
Anil Dhiman
Anil Dhiman
GIS Engineer
|
|
|
|
|
hi Anil!
perhaps yor binding your datagrid to a dataset.
try to bind it directly to the datatable on your dataset.
the cause of the (+) sign is the dataset, because dataset can contain multiple datatable and the datagrid can only show 1 datatable at a time.
hope that helps!
microsoc
|
|
|
|
|
Thanks it helped dear
Anil Dhiman
GIS Engineer
|
|
|
|
|
nice to know that!
happy coding!
microsoc
|
|
|
|
|
I have an instance of Image class. I want to get values of Red, Green, Blue components from the instance. I'm in dark. Please help me! Thanks!
NPS.
|
|
|
|
|
System.Drawing.Bitmap b = new System.Drawing.Bitmap("yor flene");
System.Drawing.Color color = b.GetPixel(100,100);
color.ToArgb();
|
|
|
|
|
Hi,
I am trying to use the SendMessage API function to send a message to an edit box. The specific message is the EM_GETRECT message to retrieve the rectangle of the edit box for custom painting.
The MSDN library states that I have to send a pointer to a RECT structure as the lParam parameter. I have defined the RECT structure, as I have used it earlier. I just have no idea how to create, find or attach a handle to the RECT structure. If I try to pass just the RECT structure, the SendMessage method returns with a "parameter is incorrect" message.
Any help would be appreciated.
Regards,
Stefan.
|
|
|
|
|
|
Hi folks,
what would be a good way to make a database query cancelable? Purpose is that the user should abort the function if it takes too long.
I've already stuffed the whole database access logic into a separate thread. When the user clicks the abort button then the Thread.Abort function is called.
Problem 1: The thread ignores the Abort call until the query is completely processed.
Problem 2: Somehow I cannot fire a second query while the first hasn't finished (e.g. User quickly clicks Search->Cancel->Search). I'm not sure why - it might be the underlying Access database (please don't mock me for that - the db is set by the customer).
I'm working with .Net 1.1. Any ideas?
|
|
|
|