|
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
|
|
|
|
|
Hey all,
I have an arraylist which has InfoObjects populated in it. These infoObjects have some fields i need to implement a sort on. How is is possible to sort my arraylist having these infoobjects according to a particular field in the inofobjects?
Any comments!!
Awais Malik
|
|
|
|
|
hi,
One solution for this sort of requirement is Indexer.
Next couple of solutions will be
1. IComparable interface for single sort ( sorting based on one criteria)
2. IComparer interface for Multiple sort order ( sorting based on multiple criteria)
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
I'm trying to accomplish a certain gradient effect using the pathGradientBrush object. I need to draw a circle having a gradient with the center color red, which flows in both directions: inwards and outwards. That is, the center of the gradient with the red color needs to be located as a middle ring of the circle, and needs to change towards white as you travel both in the direction of the center of the circle and in the opposite direction.
The code I wrote is this:
GraphicsPath gp = new GraphicsPath();
gp.AddEllipse(Location.X,Location.Y,length,width);
PathGradientBrush pBrush = new PathGradientBrush(gp);
pBrush.CenterColor =colorByValue(Color.red);
Color[] colors = {Color.White,Color.Red};
Brush.SurroundColors = colors;
e.Graphics.FillEllipse(Location.X,Location.Y,length, width);
Running this code I get a red elipse with a strange small white pie shaped strip. I tried looking for examples on how to implement a gradient that flows in more than one direction but couldn't find any. Does anyboy have any ideas ?
|
|
|
|
|
obby wrote:
Running this code
where are u using the GradientPathBrush then?
obby wrote:
I tried looking for examples on how to implement a gradient that flows in more than one direction but couldn't find any. Does anyboy have any ideas ?
I saw an article here on CP showing how it works, not sure if it will help you. From my attempts I know its tricky.
As a tip: Create an object containing all the setting you wanna apply to the drawing/path, then expose that via a propertygrid, and hence can change the settings on the fly
top secret xacc-ide 0.0.1
|
|
|
|