|
How about letting the types within the assemblies inherit a given interface?
Then cast the instances to the interface on creation and the methods will be the same, but the implementation in the various types will differ.
-Larantz-
|
|
|
|
|
Hi........
The error is ...System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index
My code is like this.........
phInfo is a PlaceHolder
ptoInfoData.InfoRow[] infoRow = GetInfoRow();
for (int i=0; i < infoRow.Length; i++)
{
if (! smInfoId.Contains(infoRow[i].info_id))
{
//did some coding here
Control ptoInstance = LoadControl@"~\Controls\bnInstance.ascx");
HERE NEAR THIS LINE THAT ERROR IS COMMING
this.phInfo.Controls.AddAt( i , (ptoInstance));
}
}
Thanks in advance....
|
|
|
|
|
In the line that throws the exception, i must be a valid index. This means if there are two items in the this.phInfo.Controls, then the valid values for i are 0 and 1.
This is all an assumption, since I have no insight into the phInfo.Controls type.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
First, please use the <pre> tags for code blocks like this so the formatting is preserved.
ptoInfoData.InfoRow[] infoRow = GetInfoRow();
for (int i=0; i < infoRow.Length; i++)
{
if (! smInfoId.Contains(infoRow[i].info_id))
{
Control ptoInstance = LoadControl@"~\Controls\bnInstance.ascx");
this.phInfo.Controls.AddAt( i , (ptoInstance));
}
} Have you stepped through the code in the debugger and verified that the phInfo.Controls array (or collection) is valid?
Also, what is a "PlaceHolder"? And, more specifically, what is the Controls property on that class?
|
|
|
|
|
PlaceHolder is an asp.net control.
Into this PlaceHolder I am loading another aspx page which
is having some control....
Here I am incrementing 'i' everytime but I don't want to
add everytime to the collection so inside the 'if' condition
I am trying to add to the collection. but in the 3rd iteration
it is giving this error
Can u pls tell me logically what to do .....
|
|
|
|
|
Any reason you are using the AddAt function instead of Add ? Even though you are skipping certain loop iterations, the counter is still being incremented, so when you call AddAt in the 3rd iteration there is a chance that the counter is at least 1 position higher than the Controls collection. If AddAt is passed an index that is outside of the Control bounds, it will not add it and throw the exception you are seeing. The Add function will always add to the end of the collection, so you wouldn't see this error.
|
|
|
|
|
Add will take only one argument... I need to pass 2 arguments
|
|
|
|
|
Right, Add would only take ptoInstance as the argument and add that object to the this.phInfo.Controls collection. The other argument for AddAt is the index into the this.phInfo.Controls collection at which the control should be added. You don't need this argument when using Add as it will always be added to the end of the collection.
From what I see in your code, using
Add<code> should work. <br />
<br />
<div class="ForumSig"><br />
Scott.<br />
<hr style="height: 1px; width: 100%">—In just two days, tomorrow will be yesterday.<br />
<br />
[<a href="http://www.codeproject.com/scrapbook/ForumGuidelines.asp" target="_new">Forum Guidelines</a>] [<a href="http://www.codeproject.com/script/articles/list_articles.asp?userid=157870" target="_new">Articles</a>] [<a href="http://geekswithblogs.net/sdorman" target="_new">Blog</a>]</div>
|
|
|
|
|
Thank you very much Scott. It is working...
Thanks a lot...
|
|
|
|
|
|
I'll 5 vote you seeing that he couldn't be bothered to.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
|
i have table with multy column ,, one of this column is image
i store photo on it ,,,
my question ,if i want to update recode on this table to delete this image ...
what the SQL statment must be ...
Palestine
|
|
|
|
|
Update the record and set the field to null. Example:
update SomeTable set TheImageField = null where SomeOtherField = something
---
single minded; short sighted; long gone;
|
|
|
|
|
It wasn't much of a problem... infact, i didn't even know DataAvailable was there. But in my app you can download files from one PC to another accross a NetworkStream. Ive just added in the part where you cancel the download, and both client and server stop and go back to whatever they where doing, all good.
But, next time i try to read from the stream for whatever reason, i get whatever crap was left over from the file transfer that wasn't read earlier. This is when i found out about DataAvailable and i thought, great, so i can just read off the rest of the data from the stream when i cancel the download, and THEN carry on doing other stuff. Only problem is, it always returns with false.
Now, i know the code i use for downloading works perfectly, so i added in a line to check if there was any data on the stream just before i actually read it anyway. It said there wasn't, then it read the data and added it to the rest of the file.
Have i gotten confused somewhere? It should return true if there is data in the stream, right?
The stream gets created like this:
TcpClient tcpClient = new TcpClient();<br />
tcpClient.Connect(Address, Port);<br />
NetworkStream TransferStream = tcpClient.GetStream();
-- modified at 12:40 Wednesday 26th September, 2007
Dude... what?
Okay, so i think to myself, fine, i'll just make and connect the socket myself, then make a new stream from the socket. More line of code but y'know.
Anyways, now DataAvailable returns true.
So, the question becomes:
Why can't you use DataAvailable (and who knows what else) on a stream you got from a TcpClient?
|
|
|
|
|
Dammit, okay so it returned true... once. After that it just kept telling me there was no data... lies. There so clearly was.
|
|
|
|
|
I am currently, developing an application for family use, however, I am having trouble as to how I should code a photo gallery that allows the user to click on a thumbnail to view a larger version of the image?
Thanks,
|
|
|
|
|
Might this[^] help?
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I'm using the following code. Don't spend too much time pondering variables that are apparently not defined anywhere - just assume they are initialized correctly because I cut this right out of my code and I don't feel like qualifying unnecessary minutia:
try
{
Process proc = new Process();
string keyFile = '\"' + this.PublicSslKeyFile + '\"';
string sigFile = '\"' + tempSigFile, true) + '\"';
proc.StartInfo.Arguments = string.Format(" dgst -sha1 -verify {0} -signature {1}",
keyFile, sigFile);
proc.StartInfo.FileName = @"C:\openssl\bin\openssl.exe";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.Start();
StreamReader stdOut = proc.StandardOutput;
proc.WaitForExit(10000);
if (proc.HasExited)
{
string results = stdOut.ReadToEnd().ToLower();
success = results.Contains("verify ok");
}
}
catch (InvalidOperationException e)
{
DoSomethingWith(e.ToString());
}
The code above is somehow producing a an InvalidOperationException, but I have no idea why.
-- modified at 12:53 Wednesday 26th September, 2007
For the ultra curious, here's the php version of the process code:
$verify = shell_exec("echo -n \"".$data."\"|openssl dgst -sha1 -verify \"".$public_ssl_key."\" -signature \"".$tmp_signature_file."\"");
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
What are the details of the exception? They should indicate what line caused the exception, and if there is an inner exception, it may contain greater detail.
|
|
|
|
|
I would start by checking the syntax that the openssl.exe requires for the keyfile and sigfile.
proc.StartInfo.Arguments = string.Format(" dgst -sha1 -verify {0} -signature{1}", keyFile, sigFile);
Also, maybe try removing the leading space before dgst. Probably irrelivant but who knows.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
I'm trying to run openssl.exe (part of the windows version of openssl).
I've verified and re-verified that my command line parameters are ok.
Since the filenames being passed on the command line are completely qualified paths, I've tried using forward slashes and then backslashes in the paths.
I've tried beginning the parameter list without the space, and then with the space.
The filenames are valid and are known to exist.
The content of the files have been verified that they are in fact correct (as far as format is concerned).
The public key file was given to me by someone else, and the signature is part of the parameters passed to our web page, so I can only assume that the data is in fact correct.
Just to make sure that the openssl.exe file is working, I "corrupted" the public key file by removing the first and last line and then running the same parameters against it. The openssl.exe app returned the expected error message.
The last time I ran it, I didn't appear to get an exception.
This is driving me insane.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
According to the docs[^]:If you use the StandardInput, StandardOutput, or StandardError properties on the Process component, you must first set the corresponding value on the ProcessStartInfo property. Otherwise, the system throws an exception when you read or write to the stream
You haven't redirected the StandardInput, and you haven't defined an input file parameter for the command. According to another doc[^]:If no files are specified then standard input is used.
Openssl tries to read the undefined standard input and you get an exception. The PHP version pushes the $data through a pipe to the standard input of the openssl command, you should do the same.
|
|
|
|
|
Hi,
Is there any function to convert String/Number to "Packed Decimal" and vice versa?
Thank you.
|
|
|
|
|
There isn't anything built in to the Framework that I am aware of. You would need to write your own function to do this. Doing a quick search on Google, here[^] is some VB6 code that might get you started. (I have not tested this code, so I will not make any guarantees to it's correctness.)
|
|
|
|