|
|
Closing the file is enough.
Only set it to null if the reference is going to hang around and some code may try to use it. By setting it to null in that scenario you have a nice easy test to see if it is valid e.g. if (FileStreamObj == null)
|
|
|
|
|
I have an array full of values of type short?[] and want to display them in a MultiLine Textbox which requires values of type string[].
I can not figure out how to convert between the two value types.
Here is my code that I thought would work but I get error - "can not convert type short?[] to string[] "
NumArray = new short?[37];<br />
<br />
public void SetFormData()<br />
{<br />
textbox1.Lines = new string[37] ;<br />
textbox1.Lines = (string[])NumArray; <br />
}
Haz
|
|
|
|
|
You can't convert like that. Try this:
string[] stringArray = new string[37];
for(int i=0; i<37; i++)
{
short? num = NumArray[i];
if (num != null)
stringArray[i] = NumArray[i].ToString();
else
stringArray[i] = "";
}
textbox1.Lines = stringArray;
|
|
|
|
|
Thanks for your speedy response.
Your solution works really well in my program.
Haz
|
|
|
|
|
Wouldn't these be useful? Use like e.g.:
<br />
[Editor(typeof(System.Windows.Forms.Design.FileNameEditor), typeof(UITypeEditor))]<br />
partial string FileName;<br />
I made a dataset, but to some string properties I want to attach the EditorAttribute so I can dump the table in a DataGridView and I'd get the file selector thing for that specific column. Or is there another way to achieve this? (Other than implementing GetProperties ofcourse, I'm a lazy bastard ).
Wout
|
|
|
|
|
wout de zeeuw wrote: Wouldn't these be useful? Use like e.g.:
What would be useful? Partial properties?
To be honest I don't see the point.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
You can't touch the designer generated dataset classes, but you can use the partial class feature to add e.g. properties to it. So continuing on this line of thought, I'd like to be able to attach attributes to generated properties.
Just a thought.
Wout
|
|
|
|
|
wout de zeeuw wrote: You can't touch the designer generated dataset classes
Eh? If that were the case it'd be going against one of the key .NET principles of representing everything in code.
Just expand the DataSet.xsd node and open DataSet.Designer.cs , just remember not to regenerate the dataset once you've made the changes.
Infact once the dataset has been generated you can remove the schema and just include the DataSet.Designer.cs file.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
I know... usually I keep the xsd, because things change anyway, and the (query) designer is pretty neat. With the partial classes you can at least add stuff, like transactions to the class without needing to touch the designer generated code (pretty standard way of working). It's just a pity that attaching attributes in the same way is not possible.
Wout
|
|
|
|
|
I suppose. But then the designer would have to be changed so that it declared the properties as partial anyway. It'd be more sensible to include a "Designer" attribute in the dataset designer.
As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google it
|
|
|
|
|
Bwegh, this DataGridView is utterly annoying , it doesn't even respect the EditorAttribute . I wish these guys designed it to be somewhat consistent with the wonderful PropertyGrid . Seems I'll have to simulate similar behaviour by fiddling with the DataGridViewButtonColumn .
Wout
|
|
|
|
|
Just been using the DataSet designer and just realised you cannot implement partial properties. Certainly in the same way that partial classes are implemented.
What's to define which class is executed first? In partial classes the method blocks are not seperated across files they're in the same file because otherwise which order do you process them in?
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
Hi,
I am working on a http content blocker for child protection from inproper web sites. To handle the navigated web sites from internet explorer, i am using the SHDocVw.Internetexplorer. However, i could not handled the other browsers like Netscape or Opera. Thanks.
Kind Regards,
Allen
|
|
|
|
|
AAndrews wrote: Thanks.
Thanks for letting us know that you can't handle Netscape and Opera.
You havn't actually asked a question here.
I'm assuming you're asking for some help in blocking stuff from Opera & Netscape?
The best way would actually be to make the program act as a filter on the ethernet ports. I.e. all data being sent via TCP/IP is sent to your program, it does it's validation, if it fails it doesn't pass on the message (or throws an error), if it passes it allows it to continue on its path to the destination.
As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google it
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
Ed.Poore wrote: As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google it
Sounds like signature material
|
|
|
|
|
Reading it again it does doesn't it. Now how to I change the sig in CPHog...
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
Ed.Poore wrote: Reading it again it does doesn't it.
Yep, and I've seen some good sig material the past few days. Now only to get off my arse and start doing some sig
Paul
|
|
|
|
|
Beaten you to it
As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google it
|
|
|
|
|
Ed.Poore wrote: Beaten you to it
Oh well, there are plenty of others and besides, I can do a variation
I wrote:
Now only to get off my arse and start doing some sigs
and that in itself could be one
I'd help but I'm too lazy to google it
|
|
|
|
|
Do you think AAndrews is annoyed we've hijacked his post?
As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google itLast modified: 22 July 2006 16:47:45 --
|
|
|
|
|
Ed.Poore wrote: Do you think AAndrews is annoyed we've hijacked his post?
I don't know. I hope he's cool about it Maybe he will do a sig too
Here is a link to one I saw yesterday: frog puzzle[^]
The last two sentences were sweet Awww, what the hell, I did the whole thing :->
"If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm." [Jack Klein]
|
|
|
|
|
PaulC1972 wrote: Awww, what the hell, I did the whole thing :->
|
|
|
|
|
Now it is a matter of getting CPHog to work on my desktop machine. It works fine on the laptop but not here. Shog and I couldn't figure out what was going on. Same flavor of GreaseMonkey and Firefox and different results.
|
|
|
|
|
How secure are these algorithms for cryptography? Can you use these functions for commercial applications or would one need to create your own cryptography hashing function? I want to use one of these cryptography functions to prove that the DB's data has not been tampered with. So on my side the hashing number would be stored as well some 3rd party to show that the two hashing numbers are equal.
MD5CryptoServiceProvider
SHA1CryptoServiceProvider
SHA384Managed
Thanks
|
|
|
|