|
In a console application you don't have a form to run. You move the functionality from the form in to the Main method and remove the Application.Run(...); . You also have to change the Project Settings to change the output type to "Console Application"
|
|
|
|
|
By "not working" you mean that you can't compile it, or runtime error?
Try to change your code this way:
//Bite here
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private static void StartDownload()
{
WebClient Client= new WebClient();
Client.DownloadFile("http://support.toshiba-tro.de/tools/SatellitePro/spa100/manual/userman-na-en.zip",@"c:\temp\xxx.csv");
}
Of course that'll work only if this is your entire code, not just snippet.
Cheers,
Svetlin
|
|
|
|
|
You have named your class the same as the WebClient class that you are trying to use. Either rename your class, or specify the complete namespace of the class you are trying to use.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hey Guffa,
I've followed your advice and is working.
Thkx.
By the way, you have a nice website.
rgrds
Marcel
|
|
|
|
|
mhm001 wrote: By the way, you have a nice website.
Thanks.
---
single minded; short sighted; long gone;
|
|
|
|
|
hi all,
In my application, i would like to use DateTimePicker to get the Date value (mm/dd/yyyy). I am using this
code "datetimepicker1.value.date ",
but i am still getting this value (mm/dd/yyyy HH:mm:ss) .
What i wish is only the "mm/dd/yyyy". Actually i was tried before set the datetimepicker format to mm/dd/yyyy, then get the value in type of String. But after that, i cant convert it into mm/dd/yyyy in type of Date. Anyone can guide me to solve my problem?
Thanks in advance
cocoonwls
|
|
|
|
|
Try to use format
ex: Format(datetimepicker1.value.date, "dd/MM/yyyy")
HTH
|
|
|
|
|
string strDate = dateTimePicker1.Value.Date.ToShortDateString()
DateTime dt = DateTime.Parse(strDate)
It's working well. You can attemp to run it.
It seem to be a solution or an answer.
|
|
|
|
|
string myDate = dateTimePicker1.Value.ToShortDateString();
If you wish to convert it back to DateTime you can do it with :
DateTime.Parse(myDate);
|
|
|
|
|
Hi,
First,thanks for the replies.
I cant split the value to "mm/dd/yyyy" with using datetimepicker.value.date.toshortdatestring or datetimepicker.value.toshortdatestring . But when i use datetime.parse(string) , the format will become "dmm/dd/yyyy HH:mm:ss" again. And if i use "Format(datetime,"mm/dd/yyyy")", its prompt me an error msg.
I would like to have the value in format "mm/dd/yyyy" is becouse i will insert this value into database.Please anyone guide me to the right way.
thanks in advance
cocoonwls
|
|
|
|
|
hi fellows
i'm creating a class diagram in VS 2005, the class diagram option shows me all the classes of the project but it doesn't show the links between classes.
Is this because half my classes are "Serializable"
Do reply
Sair
-- modified at 3:52 Thursday 19th April, 2007
|
|
|
|
|
No - it's because it can't detect links between your classes, e.g. because you haven't inherited one from another.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
most of my classes are serializable i.e. thay cannot be inherited.
can u explain a little about Links between classes?
|
|
|
|
|
Errm - you can inherit serializable classes. Who told you that you couldn't?
Take the following example:
[Serializable]
public class A
{
private int count = 0;
public virtual void OnInit()
{
count = 10;
}
}
[Serializable]
public class B : A
{
public override void OnInit()
{
base.OnInit();
}
} As you can see, B inherits from A. This is perfectly acceptable (and both classes would serialize just fine.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
VS 2003 that i'm working with tells me that serializable classes can't be inherited. i haven't tried inheriting them myself.
i'll just try it for myself.
Thanks for the example.
Regards
|
|
|
|
|
Hai
I Fresher in C# i need a help. i using the datagrid view in a form1. i add the record the form another the form2. When the form2 use and load the form1.when form1 load the datagrid will automatical datagrid refresh.(form2 add record are show in the form1 datagrid)
nuraprakash
|
|
|
|
|
Hi,
i really don't understand your question.
You need to refresh the Grid (which is placed on Form1) from Form2?
If so: store a reference to your Grid from Form1 to your class Form2
Greetings
|
|
|
|
|
I have a stupid question like this
How do I copy a row and paste it into a new row at run time?
I know I can use the getClipboardContent method and work with this content. It seems to be a bad way, even unexpected result.
Help me solve my problem .
Thanks in advance
It seem to be a solution or an answer.
|
|
|
|
|
The ClipboardContent Method is ok.
pls put your code we will help you in this regard.
Regards,
Satips.
|
|
|
|
|
My code is here
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
{
DataObject obj = dataGridView1.GetClipboardContent();
str = obj.GetText(TextDataFormat.CommaSeparatedValue).Substring(1).Split(',');
}
private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
DataGridViewRow dgvRow = dataGridView1.Rows[0];
for (int i = 0; i < str.GetLength(0); i++)
dgvRow.Cells[i].Value = str[i];
dataGridView1.Rows.Add(dgvRow);
}
catch (Exception ex)
{
}
}
But it throws an exception "Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound"
I am very confused. Kindly help me. Thanks
It seem to be a solution or an answer.
|
|
|
|
|
Hi,
Would this be a good way to prevent some SQL Injections?
I am trying to find the best easiest way to use of command parameters whenever i receive user input to query a database.
I have alot of queries so im trying to find a easy reusable procedures to make use of sqlcommand parameters.
<br />
SqlConnection conn = new SqlConnection(_WebConfig.ConnectionString.ToString());<br />
try<br />
{<br />
<br />
DataTable dtVal = new DataTable();<br />
SqlDataAdapter da = new SqlDataAdapter("SELECT ID, Full_Name, Surname " +<br />
"FROM Users " +<br />
"WHERE Full_Name = @LoginUname " +<br />
"AND Password = @LoginPword", conn);<br />
da.SelectCommand.Parameters.Add("@LoginUname", SqlDbType.VarChar, 30);<br />
da.SelectCommand.Parameters["@LoginUname"].Value = LoginUname;<br />
<br />
da.SelectCommand.Parameters.Add("@LoginPword", SqlDbType.VarChar, 15);<br />
da.SelectCommand.Parameters["@LoginPword"].Value = LoginPword;<br />
<br />
if (conn.State == ConnectionState.Closed | conn.State == ConnectionState.Closed)<br />
{<br />
conn.Open();<br />
}<br />
da.Fill(dtVal);<br />
<br />
if (dtVal.Rows.Count == 1)<br />
{<br />
return true;<br />
}<br />
else<br />
{<br />
return false;<br />
}<br />
}<br />
catch (Exception ex)<br />
{<br />
throw ex;<br />
}<br />
finally<br />
{<br />
conn.Close();<br />
conn.Dispose();<br />
} <br />
Any advice or other methods would be greatly appreciated
Thanks
|
|
|
|
|
|
Take a look at this[^]article it will help you.
Regards,
Satips.
|
|
|
|
|
Hi,
that link i snot giving any perticular information regrading validation.
pls help
|
|
|
|
|
I need help on encrypting password authentication using MD5, although i found the answer to doing it but it is done on Visual studio 2003, as iam doing it on Visual studio 2005 it is different coding style and when i dowloaded the vs 2003 coding file, it is unable to convert it to visual studio 2005 coding file, so i need your help on this problem or u can redirct me to any site that is doing this? i need the codes for password encrpytion using MD5. I am using Visual studio 2005 and sql server 2005. Thank you in advance.
|
|
|
|