|
hello ,
is it possible to create a c# application that detect if the PC is shuting down
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
what for you want that application ? if PC shuts down ,application also shuts down
Koushik
|
|
|
|
|
ellllllllie wrote: hello ,
is it possible to create a c# application that detect if the PC is shuting down
Yes. There I've answered your question.
|
|
|
|
|
How can add a property to a existing .NET control. For eg: Add a property "AllowNumbers" to textbox control.
Thanks
Until you realize this message has nothing to say, its too late to stop reading
|
|
|
|
|
derive a new class from it and add your property
public class MyTextBox : TextBox
{
public MyTextBox() : base()
{
}
private bool allowNumbers = false;
public bool AllowNumbers
{
get{ return this.allowNumbers; }
set{ this.allowNumbers = value; }
}
}
|
|
|
|
|
Thanks a lot.
I am facing one more issue.
I have created a user control, but when I add it to the form from the toolbox I get following code in the designer file:
this.usercontrol1 = new usercontrol.usercontrol();
instead of
this.usercontrol1 = new usercontrol();
This is causing build errors.
Any help with this ?
Until you realize this message has nothing to say, its too late to stop reading
|
|
|
|
|
Put your control in the same namespace...
|
|
|
|
|
The form and the user control share the same namespace
Until you realize this message has nothing to say, its too late to stop reading
|
|
|
|
|
What kind of error ?
The compiler returns an error message, if error comes.
|
|
|
|
|
Line of code giving error:
this.dataGridWrapper1 = new DataGridWrapper.DataGridWrapper();
error description:
The type name 'DataGridWrapper' does not exist in the type 'DataGridWrapper.DataGridWrapper'
DataGridWrapper is the namespace and also the class name for the usercontrol.
Until you realize this message has nothing to say, its too late to stop reading
|
|
|
|
|
That means, there is something wrong with DataGridWrapper namespace or DataGridWrapper class. Not in usercontrol.
Please rename your namespace, not the same name with your class.
Then just put the right namespace. That means, in namespace "DataGridWrapper" there is no class with the name "DataGridWrapper"....
|
|
|
|
|
great it worked!!!
stupid me
probably i had confused .net by same names
Until you realize this message has nothing to say, its too late to stop reading
|
|
|
|
|
Im well aware that there are a gazillion of AOP inspired samples out there that show how to intercept ContextBoundObject.
ServicedComponent inherits ContextBound, but none of those examples works when applied to SC.
Have anyone done this?
I pretty much only want to log parameters and do some basic serup when a method is called.
|
|
|
|
|
A database having two tables, Company and Cust.
Company feilds : Cid, Cname
Cust Feilds: custId, custName, Cid(same as Company)
I bound the Company:Cname to a combobox,
I want to write a query like:
"select * from Cust where [Cid]= ???"
???=(here the Cid of selected Cname from comboBox)
how to get the corresponding Cid feild of combobox selected Cname??
|
|
|
|
|
Set Cid as the valuemember for the combo and Cname as the display member. Then the where clause will become - "where Cid = combobox.selectedvalue"
Hope it helps.
Until you realize this message has nothing to say, its too late to stop reading
|
|
|
|
|
Thanks for replying.
d@nish wrote: where Cid = combobox.selectedvalue"
I also had tried this, but its giving error "Datatype mismatch in criteria exprssion"
Also when i debug the query, comboBox.SelectedValue gives the index value of selected item, not the Cid feild value from Company table.
any suggestion or link u can fwd me.
|
|
|
|
|
assuming you've set the DataValueField member when databinding...
<br />
combobox.SelectedValue<br />
|
|
|
|
|
Eduard Keilholz wrote: assuming you've set the DataValueField member when databinding...
I had set the comboBox.DisplayMember = "Cname" (name of company)
comboBox.Valuemamber="Cid" (id of company)
but still not ok??
Eduard Keilholz wrote: combobox.SelectedValue
I also had tried this, but its giving error "Datatype mismatch in criteria exprssion"
Also when i debug the query, comboBox.SelectedValue gives the index value of selected item, not the Cid feild value from Company table.
any suggestion or link u can fwd me.
|
|
|
|
|
this code works fine for me:
this.comboBox1.DataSource = this.dataGridWrapper1.table;
this.comboBox1.ValueMember = "ID";
this.comboBox1.DisplayMember = "DT";
:
:
:
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) {
string s = this.comboBox1.SelectedValue.ToString();
}
I get the id corresponding to the selected dt
Until you realize this message has nothing to say, its too late to stop reading
|
|
|
|
|
thanks a lot.
I had set the sort property of combobox= true,
this is creating trouble.
But, why its creating the error. Any clue?
But still there is another problem,
When the query is giving error, it stops at fill method of DAdapter,
The exception is "Datatype mismatch in criteria expression"
I cheked the DB datatype, both are same in both column.
Do you know the reason.
|
|
|
|
|
show the concatenated string
like
"select * from table where cid ='" + comboBox.SelecteValue.ToString() + "'";
|
|
|
|
|
|
So what happens when I visit your site from the UK and my language is set to "en-gb"? I can understand "en-us" but you won't display anything to me.
Also, your database is not normalised. What happens if you want to add a new language in the future? This article might help: Normalising the data model[^]
pyde wrote: Have somebody any tips? I don´t get it to work.......
Since you don't say how it doesn't work we can't actually give you any specific help. HOW does it not work? WHAT does it do that it should not? WHAT doesn't it do that it should?
|
|
|
|
|
the idea is when the user are in the default.aspx he or she can from an calendar choose some events which are disposed in the calender and it's information is poped up in a panel where you can se the different language for events.....
So I select a day from the calendar which are underlined and the panel is not show the information...
this code I'h in the masterpage.cs to for the calendar
protected void calEvents_DayRender(object sender, DayRenderEventArgs e)
{
DataSet ds = CacheUtility.GetEvents(Cache);
DataView dvEvents = new DataView(ds.Tables[0]);
string strFilter = String.Format("eventDate >= '{0}' AND eventDate < '{1}'", e.Day.Date.ToString("yyyy-MM-dd"), e.Day.Date.AddDays(1).ToString("yyyy-MM-dd"));
dvEvents.RowFilter = strFilter;
e.Cell.VerticalAlign = VerticalAlign.Top;
if (dvEvents.Count > 0)
{
e.Cell.Controls.Add(new LiteralControl("<p>exhb</p>"));
e.Cell.BorderColor = System.Drawing.Color.Black;
e.Cell.BorderWidth = 1;
e.Cell.BorderStyle = BorderStyle.Solid;
e.Cell.BackColor = System.Drawing.Color.Yellow;
}
}
/max
|
|
|
|
|
Hi, I am facing a problem in GDI+ drawing , I have drawn a rectangle on the panel and rotated to some angle. Anyone can guide me how can I apply mouse hittest on the rotated rectangle. I will be thankful to you. I am using following code to draw and rotate the rectangle.
<br />
Matrix mx = new Matrix();<br />
mx.RotateAt(30, new PointF(70, 70), MatrixOrder.Prepend);<br />
e.Graphics.Transform = mx;<br />
g = e.Graphics;<br />
Rectangle rect = new Rectangle (10,10,100,100);<br />
Regards,
|
|
|
|