|
Hey,
When I write a file to my Harddisk and try to read (append) the next line (in my code) it craches. He says that the file doesn't exists... But when I wait 3-9sec it exists... How Can I for c# to immediatly write it on my Harddisk and not cache it our something?
thx!
|
|
|
|
|
It's very probably that you forgot to close your file before you tried to open it again. Can you show us the code?
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
Code was inside "Using".
Works fine now
thx!
|
|
|
|
|
Hi
I want to create forms with glassy look and feel for that i want to change the shape of all controls like buttons, text box , and list controls , Menu. How can do it? As i have comeplted coding with all logics i want to write some global stuff for my project and apply it where ever i need by inheriting.
Its a windows based C# application....
Thanks.
|
|
|
|
|
Type in 'glass' in the search box above you. Many articles about this topic.
Look into Framework 3.0 and WPF
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
can we create custom events without delegates? if not why? please anybody pls
vani
|
|
|
|
|
Events use delegates. You don't always have to create one; you can use an existing one if the signature fits your event. Say you've got an event called Foo in your class:
class Bar
{
public event EventHandler Foo;
}
There you've just declared an event without having to declare a separate delegate.
If you have some custom event args:
class MySpecialEventArgs : EventArgs
{
...
}
...and you want to use those event args in your event, you can use the generic System.EventHandler<T> delegate:
class Bar
{
public event EventHandler<MySpecialEventArgs> Foo;
}
|
|
|
|
|
Hi,
how to print a section of the page using c#.net
thanxs
tirumal
|
|
|
|
|
There are so many article on how to print you may take a look on them first atleast you will get an overall idea that may also narrow down your likelyhood requirements. Well i try to give you an idea.
PrintDocument is the most important object with that you may write whatever you want to print/printpreview.
e.g
public void printdocuemtn1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawString("Hello World");
}
once you have what you want to print you can pass the printDocument object to the printpreviewDialog object i.e
PrintPreviewDialog ppdObj = new PrintPreviewDialog();
ppdObj.Document=docuement1;
ppdObj.showDialog();//to preview
if you want to print without displaying a preview then apply the print() method on the printDocument object.
|
|
|
|
|
can anybody suggest me by giving exact difference between delegate and event
vani
|
|
|
|
|
Events and Delegates[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Delegate is the abstract way to call any method or u can say it acts like a pointer to the method.Where as event is a interrupt which is caused by the user's action and call the event handler attached with that event to do desired processing.U can make custom events by using delegates.
rahul
|
|
|
|
|
|
Hi,
I can read file/directory permissions using
ManagementPath class
and
path.RelativePath = "Win32_LogicalFileSecuritySetting.Path='c:\\oracle';
etc.
Besides, I need to read if that particular permission setting is inherited or not,
as it is seen from the image attached-the column "Inherited from"-
Is there a way?
Thank you...
Click here for sample image for permissions
|
|
|
|
|
I think I've found it.
It's like:
string dirPath = @"c:\\oracle\temp";
DirectorySecurity ds = Directory.GetAccessControl(dirPath);
AuthorizationRuleCollection arc = ds.GetAccessRules(true, true, typeof(System.Security.Principal.NTAccount));
foreach (FileSystemAccessRule fsar in arc)
{
string identity = fsar.IdentityReference.Value;
string access = fsar.AccessControlType.ToString();
string rights = fsar.FileSystemRights.ToString();
bool inherited = fsar.IsInherited;
}
string filePath = @"c:\\oracle\sqlnet2.ora";
FileSecurity fs = File.GetAccessControl(filePath);
arc = fs.GetAccessRules(true, true, typeof(System.Security.Principal.NTAccount));
foreach (FileSystemAccessRule fsar in arc)
{
string identity = fsar.IdentityReference.Value;
string access = fsar.AccessControlType.ToString();
string rights = fsar.FileSystemRights.ToString();
bool inherited = fsar.IsInherited;
}
|
|
|
|
|
How i can Send ArrayList to WebMethod ? i used this code in WebService class
[WebMethod]<br />
public void getData(ArrayList DataS)<br />
{<br />
}
and send data from clinet to Web Service like this
localhost.Service BB = new localhost.Service();<br />
<br />
ArrayList dS = new ArrayList();<br />
<br />
BB.getData(ds);
this code is not work , any one can Exp this problem ?
|
|
|
|
|
Hi,
As i want to store more than a value for a single key, i am using
NameValueCollection for storing the values.
Periodically (say for every 10 seconds), i will remove the values for
further processing with
nvCollection[Key]=null;
In this case, the null is also counted as a value. How can i
eliminate this null value.
With thanks,
Sakthi.
|
|
|
|
|
To remove values for a key, use the NameValueCollection.Remove() method.
Cheers,
Vikram.
The cold will freeze our stares
We won't care...
|
|
|
|
|
Hi,
NameValueCollection.Remove() Will remove even the key .
i.e. entire key value pair will be removed.
But i want only the values to be removed retaining the key.
With Thanks,
Sakthi.
|
|
|
|
|
what do you mean by 'the null is counted as a value'?
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
u can try
if( nvCollection.Contains(key))
{
String oldkey = key;
nvCollection.Remove(key);
nvCollection.Add(oldkey,newvalue);
}
rahul
|
|
|
|
|
Hi,
I am storing data into the NameValueCollection.For every 10 seconds i
have to take the values out, for that i am using
nvc.getValues(key)
After that i am clearing the values for that key by
nvc[key]=null;
In this case null is also considered as one of the value for that
key. When i use remove, the key is also cleared.
As i want the order of the key to be preserved.i dont want to do
anything with the key.
|
|
|
|
|
Hi,
have to parse a big Textfile with about 33000 lines and at the moment this is very slow.
A colleague advised me to read the file into a buffer (byte Array) and than parse it. Thats ok, but i need the "readline" functionality.
How can i read the buffer line-by-line like the Streamreader?
I'm sure someone knows
|
|
|
|
|
I guess you could always convert the byte array into a string and then split it based on Environment.NewLine. This sounds as though it wouldn't be very performant either.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
you could use FileStream to copy the file into a MemoryStream, and later use StreamReader from MemoryStream to parse it.
<br />
FileStream fs = new FileStream("text.txt", FileMode.Open, FileAccess.Read);<br />
MemoryStream ms = new MemoryStream();<br />
<br />
byte[] buf = new byte[4096];<br />
int bytes = 0;<br />
while((bytes = fs.Read(buf, 0, 4096)) > 0) {<br />
ms.Write(buf, 0, bytes);<br />
}<br />
fs.close();<br />
<br />
StreamReader sr = new StreamReader(ms);<br />
string x = sr.ReadLine();<br />
My second computer is your linux box.
|
|
|
|