|
I just tried it out, it is amazing, thankyou very much. Except I don't understand the:
this.FormClosing += new FormClosingEventHandler(MyForm_FormClosing);
VC# EE just gave me a load of errors on that, and I don't quite know what it's doing anyway.
Well, thanks for the great help.
|
|
|
|
|
Can you please say what the errors are?
|
|
|
|
|
Hi, I need a little help.
I am wanting a message such as "Do you really want to quit?" to be displayed when a user clicks the X (close button) in the corner of the form. I have tried some methods that just haven't worked, as I do not know how to make the Close(); function display a bool to then be used in an if statement.
Any ideas?
Thanks.
|
|
|
|
|
you can use the FormClosing event to check if the user really wants to close the window...
cellardoor
|
|
|
|
|
Thankyou for your help, it works now
|
|
|
|
|
Hi!
Is there a function in C# that checks if a string is numeric?
Thanks in advance
|
|
|
|
|
There are several possibilities. You could use the TryParse methods provided by the numeric types like double or int . Also the Regex.IsMatch method would be an opportunity.
"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
|
|
|
|
|
Hi
You can use for loop statment to check each of character.or use
regx class for System.Text.RegularExpressions
Example:
this example check string for currency.
public static void Main ()
{
// Define a regular expression for currency values.
Regex rx = new Regex(@"^-?\d+(\.\d{2})?$");
// Define some test strings.
string[] tests = {"-42", "19.99", "0.001", "100 USD"};
// Check each test string against the regular expression.
foreach (string test in tests)
{
if (rx.IsMatch(test))
{
Console.WriteLine("{0} is a currency value.", test);
}
else
{
Console.WriteLine("{0} is not a currency value.", test);
}
}
}
|
|
|
|
|
Have a look at System.Char - it has the members IsDigit and IsNumber .
Regards,
Tim
|
|
|
|
|
How to change ms access column name in c#, using ADOX?
i have this sample on VB to change table name:
Call RenameTable("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=c:\example.mdb", "test", "changed")
Sub RenameTable (conStr, oldName, newName)
'Has to be OLE DB connection
'Create object and connect to DB...
Dim objADOXDatabase
Set objADOXDatabase = Server.CreateObject("ADOX.Catalog")
objADOXDatabase.ActiveConnection = conStr
'Change the name...
objADOXDatabase.Tables(oldName).Name = newName
'Clean up...
Set objADOXDatabase = Nothing
End Sub
May be its possible transform this sample to c#?
|
|
|
|
|
Hello,
I have created a console application that takes a file path as input.Now i want to limit only text files to this input.how do i identify the file type to be text?It can be any like .txt,.doc
rgds,
chax
chax
|
|
|
|
|
You can use the String.EndsWith() function.
|
|
|
|
|
Hi all,
I was just spending hours on finding a memory-leak in my application. Now I found it and closed it with a workaround but don't know why I needed a workaround.
I have an object which contains a very big 2d-array (which consists of 3,000,000 PointF structs). I fill the array and Windows Task-Manager shows that my application uses 24MB more RAM.
Then I execute following code:
myObject = null;<br />
GC.Collect();
and nothing happenes! But when I execute the code
myObject.bigArray = null;<br />
GC.Collect();
the 24MB memory is freed and I'm happy.
Why is that? When I kill the reference to myObject, then there is no reference to the array and the GC should also free the memory, but it doesn´t
Can anybody tell me why?
BR
Alexander
|
|
|
|
|
I'm unable to reproduce the behavior (I'm running .NET 2.0). This is the program I tried
class A
{
public PointF[] points = new PointF[1000000];
}
public class Test
{
public static void Main()
{
Console.ReadLine();
A a = new A();
Console.ReadLine();
a = null;
GC.Collect();
Console.ReadLine();
}
}
Can you post a stripped down version of the code demonstrating the problem? Also, how did you measure the memory usage/drop? Memory Usage in TaskManager is not accurate, VM Size is a better measure. Better yet, you can use one of the performance counters (Type perfmon.msc at the command prompt, right click on the graph, click Add Counters, choose the .NET CLR Memory performance object, select your process from the list box, choose #Bytes in all Heaps and repeat the experiment. You should see the counter value drop).
|
|
|
|
|
Web page with:
this.grdZahtev.DataSource=zahtevi;
this.grdZahtev.DataKeyField="id";
I need to select datagrid row which contain data where (for example) id=20
TIA
|
|
|
|
|
Hi, I got that error when I tried to setup an application I made using csharp where it works on data from sql sever db. But on my own machine the setup package works fine, I ma stuck on that bug and I tried all ways, I hope some one help me
Unable to get installer types in the 'app-path'+'programname.exe' assembly --> unable to load one or more of the requested types. Retrieve the loaderExceptions property for more information.
Regards,
Hisham Galal <me4webby@yahoo.com>
|
|
|
|
|
I am not an expert, but it seems you are missing some dll on the target machine. If this dll is present on your development machine, this may explain why it does not run on the target.
|
|
|
|
|
Hi!
Dear fellow ... i m building an application in visual studio 2003 in C# asp .net web application ....
I had a tree view in one frame and i open new forms accoring to the clik of the tree view But i have to fill this form after capturing the click event of the tree view as i need the value of that particular clicked node so that i may retrive my data From my DB according to that cliked node ........i dont know how to capture the events too please send me code in C#.... instead of asp
Thanx
|
|
|
|
|
You can use the e.Node property in the treeView.MouseClick (or AfterSelect) events.
|
|
|
|
|
how can zoom in picture with very details
(I have Tehran map and I want when click on addressBotton in my interface ,
address found in map or I zoom in map and find address)
|
|
|
|
|
Sounds like you want to use the google maps API.
If you have a bitmap and you zoom in, you will never have details, google maps loads more and more detailed bitmaps, it doesn't just zoom in on the one.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi.
Yes you should have a lot of photo from up to down.if u cant take picture tha i thing so ; i seggest u should use another programing for your target like vrml.it just a txt file but do your work.inested of taking picture u should design a 3d enviorment with text command but i thing its so deficult for one.u should have many person to do this.
|
|
|
|
|
I added xml file to Visual C# 2005 Express project so it is embedded to a
dll file.
In code I need to assign this file contents to a string like:
string str= filetostr("myxml.xml")
How to implement this ?
Andrus
|
|
|
|
|
I've done something similar once with a XML Schema file.
Stream stream = this.GetType().Assembly.GetManifestResourceStream("Troschuetz.BirthdayManager.BirthdayManager.xsd");
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(stream);
This code was inside the main form of my windows application assembly to which the file "BirthdayManager.xsd" was added as resource. I had to prefix it with the default namespace of this project "Troschuetz.BirthdayManager".
"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
|
|
|
|
|
thank you.
Stream stream = GetType().Assembly.
GetManifestResourceStream
("myprojnamespace.DefaultReport.xml");
works ok.
How to convert returned stream to string ?
I tried
string lcString = stream.ReadToEnd();
but got error
//Error 2 'System.IO.Stream' does not contain a definition for 'ReadToEnd'
Andrus
|
|
|
|