|
Cheers that worked, still a bit of a gap but between rows that are still remaining but it's better than having unused controls.
|
|
|
|
|
Hi,
i have a problem with a property of my selfmade usercontrol.
The usercontrol contains a toolstrip and i want to make the toolstripitems available as a property.
my usercontrol property is a List<toolstripbutton> but i always get the error in designtime that toolstripbutton isn't marked as serializable.
anyone any idea how i can solve this problem..
thx
Kurt
|
|
|
|
|
Hey,
How can I hide a folder from .NET?
I'm making a folder for writting some files to and at the end of the program I zip that folder. But I want this folder to be invisible for the user.
thx!
|
|
|
|
|
you can make files and folders hidden.
DirectoryInfo di = new DirectoryInfo("foo");
di.Attributes = FileAttributes.Hidden;
hope this works
for files you can use File.SetAttributes.
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
|
Hello,
I have the following problem: I have created my own TextBox class (valid inputs are only numbers => NumericTextBox). It's naturally derived from the .NET TextBox control. It works fine. In the next step I tried to create a control, which can be inserted into a ToolStrip with the designer of VS2005. So I derived from ToolStripControlHost and delivered in the constructor my NumericTextBox. In the abstract it works. Only numbers can be inserted, but the property MaxLength (inherited from the original TextBox) is not supported. For example I set MaxLength to 5 but I can input more than 5 characters (numbers). Has anybody an idea, why this doesn't work?
Alternate: I can derive my ToolStripNumericTextBox from ToolStripTextBox. This works fine, but now I have to maintain the code twice. Once for the normal NumericTextBox and once for the ToolStripNumericTextBox. Can I avoid this?
Greets
Patrick
-- modified at 10:08 Tuesday 3rd April, 2007
|
|
|
|
|
You could try to limit the length yourself in exactly the same spot as where you limit the input to numbers only. I know this is a work around, but at least it's better then having to maintain two sets of the same code.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
|
|
|
|
|
Hi everyone ,
I have a problem here, my program can automatic display 12 files when the button is click.I use timer to let the 12 files to display orderly.
But my question is
" How to allow the 12 files to display randomly everytime when i click the button"
Thank for helpin
|
|
|
|
|
could you explain more ??
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Yes...
The 12 files is the 12 waveform to be display one by one automatically when i click the button.My program can only allow the 12 waveform to display in order when i run the program( everytime when i run the program, the 12 waveform will display from 1 to 12).
Therefore my problem is " how to allow the 12 waveform to display randomly."
for example when i run the program, the third waveform will run first. And when i run the program the second time, the tenth waveform will run first.
Hope u understand..;)
thank..
|
|
|
|
|
this is what I think you need:
static void Main(string[] args)
{
RunRandomly(12);
}
static void RunRandomly(int amount)
{
ArrayList alreadyused = new ArrayList();
Random rnd = new Random();
while (amount > 0)
{
int rndint = Convert.ToInt32(rnd.Next(12));
if (!alreadyused.Contains(rndint))
{
Run(rndint);
amount--;
alreadyused.Add(rndint);
}
}
}
static void Run(int number)
{
Console.WriteLine(number);
}
if it doesn't make sense, then neither did your question I'm afraid
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
joon vh. wrote: int rndint = Convert.ToInt32(rnd.Next(12));
No need to call Convert.ToInt32 here since Random.Next returns an integer.
"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
|
|
|
|
|
wow... dunno why I assumed it didn't :p good call
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
Hi there,
I am very new to C#.net, now I have problem to enhance my codes below so that program can upload all the *.txt from the folder to remote server. Right now my code below is only cater for 1 specific file name "text.txt". But I need your advice how can i use *.txt in c#.net. Appreciate for all the respond to my questions.
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (Request.Files.Count > 0)
{
Request.Files[0].SaveAs(@"C:\Inetpub\wwwroot\EDIHTTPS\test.txt");
}
else
{
|
|
|
|
|
Sorry...to continue the code...
else
{
httpUploadFile("http://localhost/EDIHTTPS/WebForm1.aspx", "c:\\test.txt");
}
}
|
|
|
|
|
Use Directory.GetFiles() method to get the paths of all the files in a folder.
After that you can use Path.GetFileName() to get the name of each file.
|
|
|
|
|
Thanks for your prompt respond.
But I am still kinda blur. Do you have sample coding?
Appreciate that.
|
|
|
|
|
Something like this might help:
string[] thePaths = Directory.GetFiles("c:\\My Folder");
<br />
foreach (string filePath in thePaths)<br />
{<br />
if (Path.GetExtension(filePath) == ".txt")<br />
{<br />
}<br />
}
Have a nice day!
|
|
|
|
|
Hello,
Just an info!
By using the second parameter (searchpattern) of the GetFile method like this:
string[] thePaths = System.IO.Directory.GetFiles("c:\\My Folder", "*.txt");
you don't need the loop!
If you have .Net framework >= 2.0, you also use a "SearchOption", for searching also in the SubDirectories.
All the best,
Martin
|
|
|
|
|
Hi,
How will i convert a XML datatype in SQL to a C# datatype. Can we use XMLDocument datatype in C#? If yes how can it be used?
Thanks in advance
Srivatsan
|
|
|
|
|
|
I want to create a XML document in the filesystem out of the XML that is coming from the table column. The column is of type Xml. So how will i do it. I understand that we can use the ADO classes when oing an updation into the column. How to get it into the code from the database table column?
Srivatsan
|
|
|
|
|
If your sql server is sql 2005 then there is an xml type in sql 2005 that you can use. If you are using sql 2000 then you have to convert your xml type in .net to a string and save it in a text column.
Hope that helps.
Ben
|
|
|
|
|
You start off by learning the C# syntax, then you get used to using the BCL (Base Class Libarys) and then you read up on the specifics of using ADO.Net.
You'll see that I gave a link to google with the appropriate keywords to help you find what you want.
If that's no good there are plenty of books out there on how to do this.
|
|
|
|
|
Hello. I have a big problem with network streams.
I have a network stream and, from time-to-time i have to check from messages received from the server.
My problem is that if i receive, for example, 2 messages from the server if I run in debug mode and stop just before the read, it reads both messages received. But if i run in release mode, i get only the first command(because there is a a small period of time between the two messages where stream.DataAvailable is set to false and it exits my loop).
How can I fix this problem? Because I don't know in advance how many messages the server will send.
This is my code:
<br />
if (stream.CanRead)<br />
{<br />
while (stream.DataAvailable)<br />
{<br />
numberOfBytesRead = stream.Read(myReadBuffer, 0, myReadBuffer.Length);<br />
myCompleteMessage = String.Concat(myCompleteMessage, Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead)); <br />
}<br />
} <br />
CAN SOMEONE PLEASE HELP ME???
IT'S A B IG PROBLEM FOR ME, I'M NEW IN C#
THANKS IN ADVANCE!!
|
|
|
|