|
tamir901 wrote: But if i'll stop the timer i don't think i can start it again,
can i?
Yes, see below.
tamir901 wrote: and how i can check if the user press OK, with the Dialog Result?
Yes, just get back the DialogResult and compare it to one of the values in the DialogResult enum.
I don't mean to be doing your homework for you, but sometimes seeing it in code can make it easier to understand:
if (myCondition) {
timer1.Stop();
DialogResult result = MessageBox.Show("here is my message", "caption", MessageBoxButtons.OKCancel);
if (result == DialogResult.OK) {
} else {
}
timer1.Start();
}
Christian Graus wrote:
or you'd have to write your own message box class so you can set some sort of flag.
tamir901 wrote: Can I overrite it?
You could, but it's a lot easier just to follow Christian's first suggestion and stop and start the timer.
|
|
|
|
|
Hello everybody
Is possible to push a code project to a database server? The project has built in .Net framework that is .aspx, and it has written in c#. The server has no visual studio environment, it is just database server and contains Ms_Sql. If there is any clarity problem in my question I try to explain briefly. I forgot something, is the project should be published using publisher?
Thanks
|
|
|
|
|
|
If you don't even know what ASP.NET is called, I have to wonder what it is you've created.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi, Guys, I am trying to write a code in Visual Studio 2008(C#) to open up a dialog box for user to select an image and save the image into a folder where the path can be used later in the code for later retrieval. Can anyone help me with a code. I will appreciate it very much.
|
|
|
|
|
Try the following... I think you will get an idea.
An Easy Way to Resize an Image
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Can some one give me an example to show how to access C# objects from PowerShell Script?
|
|
|
|
|
First google hit[^]
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
I am fighting with SQL syntax.
My database is MDB file, all reading work fine except
DateTime columns.
this code:
string cmdR = "select M_TEMP from MEASUREMENT where M_TIME = '2007-11-16 13:10:00'";
using (OdbcCommand catCMD = new OdbcCommand(cmdR, mConn))¨
OdbcDataReader myReader = catCMD.ExecuteReader();
...
give me exception (ExecuteReader()): System.Data.Odbc.OdbcException
with error: Data type mismatch in criteria expression.
I tried various combination,
for 'M_TIME = #'2007-11-16 13:10:00'#
then error was:
Syntax error in date in query expression 'M_TIME = #'2007-11-16 13:10:00'#'
The closest probably was
'M_TIME = #2007-11-16 13:10:00#
there were no exception but it select the first item except the one from the requsted time
and i am still not able to find the way to insert time in correct way.
Thank you for help to undertand this
Viliam
viliam
|
|
|
|
|
Looking at this[^] you may find that
string cmdR = "select M_TEMP from MEASUREMENT where M_TIME = ts'2007-11-16 13:10:00'";
using (OdbcCommand catCMD = new OdbcCommand(cmdR, mConn))
{
OdbcDataReader myReader = catCMD.ExecuteReader();
...
} may work - I don't know for sure, (I don't use ODBCas my DBs are mySQL)
Oh, and the convention for database access seems to be:
string cmdR = "SELECT field FROM table WHERE field = value";
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Thank you but there is still the exception
Syntax error (missing operator) in query expression 'M_TIME = ts'2007-01-12 13:10:00''.
viliam
|
|
|
|
|
I got a problem here. any help will be appreciated.
Currently, I am developing a windows application and I want to display another form when a user clicks on a certain button. so that when the new form is displayed the following conditions must be full filled...
1. the to be displayed form should have only one instance, meaning if the form is already displayed there is no need to display it again.
2. The to be displayed form should be a child form to the MDI form.
Kind Regards.
|
|
|
|
|
you should consider investing in a book on C# and Winforms programming.
You basically create it as a member variable, and check if it's visible, and if not, show it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Try the following..
<PRE>
rootInterface IRootInterface = new rootInterface();
IRootInterface.MdiParent = this;
IRootInterface.Show();
</PRE>
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Hi,
I am having a situation ,i've to display more than 10 fields from database to the crystal report
But since i had to display it horizontally in the report ; But it's size seems to be fixed .but vertically it can be done .
Plz help.
|
|
|
|
|
hi! im having problems with a code im working on a Windows Form Application
I will post the code I have so far:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Trabajo_de_Programacion1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string nombre;
int intentos;
intentos = 0;
nombre = textBox1.Text;
label8.Text = "Hola," + nombre + " !";
switch (comboBox1.SelectedIndex)
{
case 0:
{ intentos = 10; }
break;
case 1:
{ intentos = 8; }
break;
case 2:
{ intentos = 5; }
break;
case 3:
{ intentos = 3; }
break;
}
label9.Text = "Numero de intentos restantes: " + intentos;
Random randNum1 = new Random();
randNum1.Next();
label10.Text = "" + (randNum1.Next(4));
randNum1.Next();
label11.Text = "" + (randNum1.Next(4));
randNum1.Next();
label12.Text = "" + (randNum1.Next(4));
randNum1.Next();
label13.Text = "" + (randNum1.Next(4));
}
private void button2_Click(object sender, EventArgs e)
{
int intentosrestantes, intentos, ;
intentos = label9.Text; intentosrestantes = (intentos - 1);
label9.Text = "" + intentosrestantes;
}
}
}
The error I get is on the label9.Text and it says :Cannot implicitly convert type "string" to "int"
Thanks for the help! 
|
|
|
|
|
As errors says implicit conversions are not possible. You need to cast it. Take a look at int.TryParse()
Best wishes,
Navaneeth
|
|
|
|
|
How do I cast it? where do I add the int.TryParse()?? I have been using C# for a little while and still dont know how to use it very well :S
Thanks! ^^
|
|
|
|
|
int intentos;
if(int.TryParse(label9.Text, out intentos))
{
} These are basic things and you should really get a book to learn all these rather than from an online forum.
Best wishes,
Navaneeth
|
|
|
|
|
|
I wouldn't call that casting; interpreting a string to get a value (integer, real, date, ...) is called parsing.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
If it is parsing, then for a string like "string123", it should return 123 right?. But int.TryParse() will not do it. So more clear description would be what MSDN says.
Converts the string representation of a number to its 32-bit signed integer equivalent. A return value indicates whether the conversion succeeded.
Best wishes,
Navaneeth
|
|
|
|
|
You can use
<br />
Convert.ToInt32( label9.Text)<br />
|
|
|
|
|
Hello everybody!
I'm thinking of developing a web site ripper (copier) application in C# on Windows. As I see it, it is not a very complicated task in terms of the overall picture. However, challenges may arise when developing particular features, at a finer level of granularity.
So, in large, I think I need to:
- get the required html document
- construct a document links tree
- recursively parse the initial document to find links to other documents and add them to the document tree
- once the tree is constructed, recursively get the desired resources (say, all the documents or just the images) and store them on disc
- modify the links in the locally stored html documents to point to the local disc structure
Is there anything specific that I should be careful with? What challenges may arise? Have I missed something important? I would welcome your feedback.
Best regards!
|
|
|
|
|
fireblade80 wrote: Is there anything specific that I should be careful with? What challenges may arise? Have I missed something important? I would welcome your feedback.
I would imagine your big challenge is making sure you keep track of links so you don't recursively load the same site over and over. And that you don't jump out and end up loading all all of the web.
That and the fact that most big websites ( such as CP ) have things in place to stop you, because of the cost of such action in terms of server load.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|