|
I'm just embarassing myself more and more, aren't I?
For a minute there, I was using Int16 ?!?!
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
Create an int array of size 8, and assign a random number(range 0 to 9) for each int.
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
Thanks for replying. But this random number generator isn't as secure as cryptography RGN's.
Something like the RandomNumberGenerator class.
Cheers,
Gerry.
Gerry.
|
|
|
|
|
In my windows application I need to open Excel application in background and read some data from excel files.
What I do is
Excel.ApplicationClass excelApp = new Excel.ApplicationClass();
Excel.Workbook WB;
excelApp.Visible = false;
Then I open workbook:
WB = excelApp.Workbooks.Open(filename,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing,System.Type.Missing);
And now I want to read some data from this excel file. In access I did it in this way: WB.Names("name1").refersToRange.Cells(1,1), but here in C# there is no such method Cells(string Name), so I don't know how to access cell value in given Excel name????
Can anyone help me?
I am using office XP!
|
|
|
|
|
I had this same problem a while ago, and the solution I used was:
Assign the refering name to a variable
String sRef = (String)(nm.RefersToR1C1).Split("!"c)
which will get you something like "RxCy" where X is the row number and y is the Column number. Extract those value out, then
String Value = (String)WB.Sheets(sheetname).Cells.Item(row,col)
It's a long way to do it, but until Office 11 comes out, it's the only way I know
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
|
Basically, i dont care if a set of statements throws an exception but i dont want the program flow to be interupted. How can i do this? Something like the following:
int[] manyInts = new int[4];<br />
manyInts[0] = 1;<br />
manyInts[1] = 1;<br />
manyInts[2] = 1;<br />
manyInts[3] = 1;<br />
manyInts[4] = 1;<br />
manyInts[5] = 1;
So basically it executes every statement whether it thows an exception or not.
-- ABT
|
|
|
|
|
How about:
try
{
int[] manyInts = new int[4];
try {manyInts[0] = 1;}
catch {}
try {manyInts[1] = 1;}
catch {}
try {manyInts[2] = 1;}
catch {}
try {manyInts[3] = 1;}
catch {}
try {manyInts[4] = 1;}
catch {}
try {manyInts[5] = 1;}
catch {}
}
catch {}
...Powerful kludgy - but should work
α.γεεκ Fortune passes everywhere. Duke Leto Atreides
|
|
|
|
|
HA. That is extactly the work around that i am using.
|
|
|
|
|
Sprinkle liberally with cheese and enjoy.
α.γεεκ Fortune passes everywhere. Duke Leto Atreides
|
|
|
|
|
Do you know where I can get the whole gamut of Shell and OLE interfaces (like IOLEWindow, IViewObject, IContextMenu, IPersistStorage, etc.) in C# definitions?
I could write them myself, but oh, what a time-saver it would be to already have them written!
THANKS!
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
I don't know if anyone has put all of them into a single place, but a majority of them may be covered by several articles in the Shell Programming[^] section.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Thanks for the pointer. I'm working on an IE ToolBand, and there happens to be a toolband sample which I didn't know about.
But I suppose I'll just have to write a bunch of interface defs myself for all the others.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
Is there anyway to fool the compiler into working with an Interop library with a strong name? I am receiving the following error when trying to compile my app and sign it.
Assembly generation failed -- Referenced assembly 'Interop.WIALib' does not have a strong name
Thanks,
Steven
|
|
|
|
|
Nevermind guys, I found it. It was listed under the C# Project Options called: "Wrapper Assembly Key File."
Thanks,
Steven
|
|
|
|
|
Ok,
I built a pretty cool app for my company to use, and now I'm trying to deploy the .exe file to other users.
I've copied that file over to another computer that does not have Visual Studio .NET 2003, and it won't run without a bunch of DLL files.
How do I build the distribution app? Or is there an easier way to do this?
Thanks!!
-ed
|
|
|
|
|
You can use VisualStudio itself to build installers fairly easliy. Check out the C# Today tutorial:
http://www.csharptoday.com/content.asp?id=1691
|
|
|
|
|
You need to download and install the .net runtime on the target computer. There is no way around this.
Also, assuming you have the help installed, do a search on 'Setup Project'. You will find a few walkthroughs that show you the basics of deployment.
Hey don't worry, I can handle it. I took something. I can see things no one else can see. Why are you dressed like that?
- Jack Burton
|
|
|
|
|
|
I'm going to have to tell C# that the HRESULT is an int, so I can do my own return value.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
I'm trying to find if a bit is set in a mask.
The code:
if(pdbi.dwMask & olelib.DESKBANDINFO_Masks.DBIM_TITLE)
gets an error:
error CS0029: Cannot implicitly convert type 'olelib.DESKBANDINFO_Masks' to 'bool'
and the code:
if(pdbi.dwMask & (int)olelib.DESKBANDINFO_Masks.DBIM_TITLE)
gets an error:
error CS0029: Operator '&' cannot be applied to operands of type 'olelib.DESKBANDINFO_Masks' and 'int'
Could someone kindly explain how to get around this?
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
To make myself more clear, 'olelib.DESKBANDINFO_Masks' is an int Enum.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
Don't know for sure, but I think you need to have the Flags attribute on the olelib.DESKBANDINFO_Masks enum.
- monrobot13
|
|
|
|
|
Found out it had nothing to do with that. That line of code should be:
if(!((pdbi.dwMask & olelib.DESKBANDINFO_Masks.DBIM_TITLE)==0))
I clean forgot that in C#, true is -1 !!!!
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
jdunlap wrote:
I clean forgot that in C#, true is -1 !!!!
Its not that true is -1, in C# you cannot implicitly convert from an int to a bool. While pdbi.dwMask & olelib.DESKBANDINFO_Masks.DBIM_TITLE may result in a non-zero value; the if statement requires a bool. Which is why simply comparing that result to zero works, the comparison produces a bool which the if statement can deal with.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|