|
In the code that I have attached to my previous message I used Invalidate method inside button click event hadler(after messagebox.show statement). If I remove this statement partial rectangle is visible. if I keep it thewhole rectangle is erased after I close the MessageBox.
When I minimise and then maximise, then also rectangle is erased. I am not able to find a solution to this problem and breaking my head since yesterday. Any help to overcome this problem willbe highly appreciated.
Regards,
Prasad
|
|
|
|
|
I'm trying to have the value in a numeric up down highlight when selected by tab (for faster modification of the value). Currently it inserts at the beginning of the value. Anyone know if this is possible?
|
|
|
|
|
Hi, add an Enter handler with this content:
numericUpDown1.Select(0, numericUpDown1.Value.ToString().Length);
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Is there anyway to do this without referencing all of the numeric up downs, i have about 7 on one form and would like some way (without doing everyone individually) to do this. Thanks for your help!
|
|
|
|
|
Hi,
yes, for all events, if you add a handler programmatically
say with someEvent+=new EventHandler(myHandler);
you can specify the same handler over and over.
if you add a handler through Visual Designer, you can also choose the handler's
name.
And if that handler then needs to differentiate based on the specific control,
it should investigate its first argument ("object sender").
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi.
I'm writing an application that it connect to a SQL Server 2000 database. For testing I have 2 PC running Windows XP and in one of them I'm running SQL Server 2000.
When I run the application in the same PC where SQL is running the application works fine, but trying to connect from another PC it throws an exception connecting to the database. This is what I have:
My connection string:
string source = "Server = DEC-DEMIAN; Database = Security; User ID = Terminal2;" +<br />
"Password = 123; Trusted_Connection = False;";
Trying to connect from another PC it fails, thowing: "...SQLException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding".
I can't figure out what I missed to configure in SQL Server to be able to get remote connections. I have checked Server Properties -> Connections in SQL and it's ok.
Any help will be apreciatte.
Thankx
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
On the server, have you enabled named pipes? I have had that same problem before, and It was because I didn't enable named pipes.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
I don't know.
Where should I find the "named pipes"??.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
I don't quite remember, Google it.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
These specify the time, in seconds, to wait for the server to respond before generating an error. The default value is 15 (seconds).
"Connect Timeout=10;"
-or-
"Connection Timeout=10;"
|
|
|
|
|
hello ,
my self ankur , i am very new to .net (C#)
I had made an function in vb .net but same logic is not workin in C#
please help.
I had Written an Following Code .
try
{
da = new SqlDataAdapter(Cmd);
dt = new DataTable();
da.Fill(dt);
int i=0,j=0,p=0,k=0,m=0;
string[] arr = new string[((dt.Columns.Count) * 3)];
if (dt.Rows.Count <= 0) return arr;
for (j = 0; j <= dt.Rows.Count - 1; j++)
{
if ((j == 0))
{
for (i = 0; i <= dt.Columns.Count - 1; i++)
{
arr[i] =dt.Rows[0].ItemArray[i].ToString();
//(dt.Rows[0].Item(i));
p = i;
}
}
if ((j == 1))
{
k = p + 1;
//For k = i To dt.Columns.Count - 1
for (i = 0; i <= dt.Columns.Count - 1; i++)
{
arr[k] =dt.Rows[1].ItemArray[i].ToString();
k = k + 1;
}
}
if ((j == 2))
{
m = k;
//For k = i To dt.Columns.Count - 1
for (i = 0; i <= dt.Columns.Count - 1; i++)
{
arr[m] =dt.Rows[2].ItemArray[i].ToString();
m = m + 1;
}
//Next
}
}
|
|
|
|
|
What do you mean by "not working?"
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
I'm not really sure exactly what you're trying to accomplish here, but I think this code below might suit you better:
<br />
string[] arr = new string[dt.Rows.Count * dt.Columns.Count];<br />
int i = 0;<br />
int j = 0;<br />
foreach (DataRow dr in dt.Rows)<br />
{<br />
j = 0;<br />
foreach (DataColumn dc in dt.Columns)<br />
{<br />
arr[i] = dr.ItemArray[j].ToString();<br />
j++;<br />
i++;<br />
}<br />
}<br />
The results of this would be an array structured as:
[0] = row1 col1
[1] = row1 col2
[2] = row1 col3
[3] = row2 col1
...
Hope that helps, if it doesn't be a little more clear on what you're trying to accomplish and maybe we can come up with something better.
- Arcond
|
|
|
|
|
Hi all,
Is there any function that allows me to get an out put of Monday from a Datetime datataype?
For instance Day(2007/08/13) will return 13.
But i want to get Monday.
How do i get that?
Thanks for your time.
|
|
|
|
|
do ToString() on that and it should give you that, I think.
System.DateTime.Now.DayOfWeek.ToString();
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Thanks very much,
Its not only for today which is (System.DateTime.Now.DayOfWeek).
I wanted to do given a date allways give me the days of that week.
Datetime dt;
dt.dayofweek? can this give me name of the date monday or tuesdda etc....
Thanks
|
|
|
|
|
DateTime.Now just represets the current date as a DateTime object. So you can have your own instance and still use DayOfWeek
|
|
|
|
|
Thanks very much for your help.
Is there any function like that in SQL script?
Thanks
|
|
|
|
|
Look at DATEPART, it's kinda scary though
|
|
|
|
|
You bet. Yes it can, you can do something like this:
DateTime DateT = new DateTime(1, 3, 3);<br />
MessageBox.Show(DateT.Day.ToString());
And that will display the Day of the week of any date you specify
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Thanks,
I have a datetime column on my table( ADEDATE type datetime)
Select id, ADEDATE from Table ,I would like to get the day of the week for the result of the selecet statement.
the result of the select statement will be similar to ..
12,Monday
13,sunday
14,saturday
Which function shall i use for this task?
Thanks
|
|
|
|
|
Well, you should parse the Year, Month, and Date from the field, drop them into variables and then drop them into your DateTime object, and then return the Day of the week. Does this answer your question?
DateTime DateT = new DateTime(Year, Month, Date);
MessageBox.Show(DateT.Day.ToString());
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Thanks very much,
Well i have to use stored procudure in Sql script.All i want is how my select statement can get the days of the week for my Datecoulmn on my table?
May be i should post it Sql forum?
Did you get me now?
Thanks
|
|
|
|
|
Oh yes, I get you now. You are trying to do all this in a stored procedure. Yeah, you should ask in the SQL forum.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Use one of the many formatting options available in the DateTime object.
MessageBox.Show(DateTime.Now.ToString("d"));
MessageBox.Show(DateTime.Now.ToString("dd"));
MessageBox.Show(DateTime.Now.ToString("ddd"));
MessageBox.Show(DateTime.Now.ToString("dddd"));
|
|
|
|