|
Given the context of the article, they are meaning Visual Basic.NET. By "other languages" it looks to me that they mean other languages that use the .NET framework.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
|
I've made an Interface IDataFactory with a property ISqlDbComponent{get;set;}
a component with the interface IDataFactory:
public class DataFactory : System.ComponentModel.Component, IDataFactory
The property should be visible with
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
but isn't.
When I derive a component from DataFactory, the property ISqlDbComponent IS visible.
I don't understand why and which Designer Attribute I have to add to the property to make it visible in the first implementation and not only in derived classes.
The property is implemented in the component "DataFactory" so why it isn't visible in the designer?
Thanks a lot
Stefan
|
|
|
|
|
STW wrote:
The property should be visible with
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
but isn't.
Thats not true. That controls what the designer 'saves', and that attribute means it will be saved.
Look at BrowsableAttribute, but public Properties are visible by default.
top secret xacc-ide 0.0.1
|
|
|
|
|
Thanks for reply.
Yes, right.
I forgot to mention that I set [Browsable(true)] for the property.
Is there anything else?
Stefan
|
|
|
|
|
I'm inserting data into a text log file. I need to delete only certain lines of data, generally from line 50 to the end (EOF). I then need to write data to the same file starting at line 50.
Q. How do I delete certain lines of data???
Q. How do I delete from a certain line of data the EOF???
Q. How do I start writing at a specific line???
|
|
|
|
|
1. read each line into an arraylist, then delete the lines u dont need, then write to file again.
2. there is only one EOF and thats at the end-of-file.
3. see 1
top secret xacc-ide 0.0.1
|
|
|
|
|
Hy everyone!
I designed a windows Form which contains a control by default.
Now I do want to add another control depending on the data, meaning if the data contains ínfos which have to be displayed in the control then the control should be inserted, the Form size is changed etc. (if the length where the data is stored is not 0)
I managed to check if the data needs the second form and I changed the Forms size, but at the moment I am not sure how to insert the second control dynamicaly. I can't just throw it in like I did with the otherone and let the code being insert automaticaly.
So I do want to do something like
if(data.secondform.length!=0)<br />
{<br />
resize Form<br />
insert second control<br />
display data in the control<br />
}
the other way round shouldn't be the problem meaning removing the control again when I do get data which is not asking for the control.
Could anyone of you please tell me what I do have to do to insert the control in my Forms windows? (maybe with some code statements)
Thanks!
Stephan.
|
|
|
|
|
check
http://support.microsoft.com/default.aspx?scid=kb;EN-US;319266
Sanjay Sansanwal
www.sansanwal.com
|
|
|
|
|
is this the same for Windows.Controls?
Meaning could I use the button for example as a sample for my task?
Thanks!
Stephan.
|
|
|
|
|
The Form class in System.Windows.Forms namespace contains a Controls property which is a collection of controls. It has methods to add and remove controls, among others. Check it out on MSDN.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Here is one possible approach:
in start of program:
object Item = GetData();
...cast Item to specific type...
in your data component:
public object GetData()
{
...read the data and determine the different types of data
...now cast that data to the specific type of data
...and return that type-specific object
}
public class DataTypeOne
{ .. what makes this unique .. }
public class DataTypeTwo
{ .. what makes this unique .. }
in your form
InitializeComponents();
LoadForm(TypeSpecificItem);
...
public void LoadForm(DataTypeOne item)
{
DataOneForm form = new DataOneForm(item);
this.Components.Add(form);
}
public void LoadForm(DataTypeTwo item)
{
DataTwoForm form = new DataTwoForm(item);
this.Components.Add(form);
}
.... overload for each object type ....
This signature left intentionally blank
|
|
|
|
|
How i write a program. It can control IE6 like back,home, choose a specify link in website. Do you some information to develop it
Nothing
|
|
|
|
|
Have a look at
http://www.codeproject.com/csharp/webbrowser.asp
store your internet favourites online - www.my-faves.co.uk
|
|
|
|
|
|
Sorry, I posted that comment from Mozilla and for some reason I don't get the Clickety option in that.
store your internet favourites online - www.my-faves.co.uk
|
|
|
|
|
Hi everyone,
Which is the better way to calculate hash of a simple string, should I use MD5CryptoServiceProvider or is it OK to use this static method: FormsAuthentication.HashPasswordForStoringInConfigFile ?
Please note that it will only be used in an ASP.NET server control. I know the latter method has been designed for a different purpose, but it does exactly what I need in a simple and straightforward way (just 1 line of code), so I was wondering if this would be correct or more efficient or if I should rather use CryptoServiceProvider approach?
Also, with CryptoServiceProvider , is there a simple way of converting a byte array into a hexadecimal string represenatation (I mean simpler than iterating through the array and appending hexadecimal represenatation of each byte to the end of the string)?
Thanks in advance for any ideas,
Rado
Radoslav Bielik
http://www.neomyz.com/poll [^] - Get your own web poll
|
|
|
|
|
Radoslav Bielik wrote:
Also, with CryptoServiceProvider, is there a simple way of converting a byte array into a hexadecimal string represenatation
byte[] bits = ...;
string hash = System.Text.Encoding.Default.ToString(bits);
Jonathan de Halleux - My Blog
|
|
|
|
|
That would be actually very nice, but I'm not sure I get it right or if I'm doing something wrong. The ToString() method of Encoding class doesn't take any input arguments. There is the GetString(byte[] ...) method, but it will return a string representation of the bytes in the byte array, not a hexadecimal representation (like "7ba183d2") which is what I'm trying to do.
And finally, there is also the BitConverter class with its ToString(byte[] ...) method which works, but it will return a string where octets are separated by dashes.
Rado
Radoslav Bielik
http://www.neomyz.com/poll [^] - Get your own web poll
|
|
|
|
|
Sorry, ToString was GetString indeed. I though you just needed to convert a byte[] to string. Do you really need hex representation ? you can convert to Base64.
Jonathan de Halleux - My Blog
|
|
|
|
|
Jonathan de Halleux wrote:
Sorry, ToString was GetString indeed. I though you just needed to convert a byte[] to string. Do you really need hex representation ?
Yes, I should have made that more obvious Thank you for your response anyway!
Rado
Radoslav Bielik
http://www.neomyz.com/poll [^] - Get your own web poll
|
|
|
|
|
Just enumerate the byte[] array and use ToString("x2") on each byte - appending the value - to have a valid hexidecimal representation. Make sure you include the "2", though, otherwise your hex string may not be a multiple of 2 (so any value less than 128 would not have the first "0"):
byte[] buffer = Encoding.Default.GetBytes("Hello, world!");
StringBuilder sb = new StringBuilder(buffer.Length * 2);
foreach (byte b in buffer)
sb.Append(b.ToString("x2"));
return sb.ToString();
Software Design Engineer
Developer Division Sustained Engineering, Microsoft
My Articles
|
|
|
|
|
Yes, this is exactly what I'm doing but it looked too complicated to me and I thought that there surely must be a simpler way.
Originally, I was just concatenating the strings using the += operator, but using the StringBuilder's Append method is probably more efficient?
Thanks for your ideas,
Rado
Radoslav Bielik
http://www.neomyz.com/poll [^] - Get your own web poll
|
|
|
|
|
Ask yourself - do you want faster code or do you want to write less code? Using FormsAuthentication.HashPasswordForStoringInConfigFile is quicker to use (albeit a long method name!) but using the MD5 class (or MD5CryptoServiceProvider - it's really the same thing) will result in a little less code (not much, but will save a few extra IL instructions):
MD5 md5 = MD5.Create();
byte[] buffer = Encoding.UTF8.GetBytes(inputString);
byte[] hash = md5.ComputeHash(buffer);
StringBuilder sb = new StringBuilder(hash.Length * 2);
foreach (byte b in buffer)
sb.Append(b.ToString("x2");
return sb.ToString(); FormsAuthentication.HashPasswordForStoringInConfigFile adds a few steps for comparing the string you pass ("md5" or "sha1").
Software Design Engineer
Developer Division Sustained Engineering, Microsoft
My Articles
|
|
|
|
|
That's what I was basically interested in, which one is more efficient and elegant, and I thank you a lot for making it clear to me.
In this case, the performance was not really an issue because the operation doesn't occur too often, but the few more lines of code are good if it is a more elegant way to use MD5CryptoProvider.
Thanks again Heath!
Rado
Radoslav Bielik
http://www.neomyz.com/poll [^] - Get your own web poll
|
|
|
|