|
Hello,
This will not be possible to implement. Reason being that the AutoCompleteSource only takes String
collection and would sort the colection only in string format.
Regards,
Allen Smith
ComponentOne LLC
www.componentone.com
|
|
|
|
|
I have two date values
date1 = 23/11/2008 16:00
date2 = 30/11/2008 21:30
I want to know how many days in total which I can obtained by TimeWSpan
bu I also want to know if any hours and minutes are remaining out of the date difference?
how can I do it?
|
|
|
|
|
TotalDays
TotalHours
TotalMinutes
TotalSeconds
TotalMilliseconds
And
Days
Hours
Minutes
Seconds
Milliseconds
properties of a TimeSpan
The difference between TotalDays and Days is that they return, for example, 1.5 and 1 (the whole elapsed days) respectively.
Eslam Afifi
|
|
|
|
|
TimeSpan ts = (new TimeSpan(date2.Ticks)).Subtract(new TimeSpan(date1.Ticks));
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
but that will show the total hours between date1 and date2 when i just want the remaining hours after (date2 - date1)
|
|
|
|
|
jrahma wrote: but that will show the total hours between date1 and date2 when i just want the remaining hours after (date2 - date1)
No, the TotalHours property gives you the total hours. The Hours property gives you the remaining hours.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Mbah Dhaim wrote: TimeSpan ts = (new TimeSpan(date2.Ticks)).Subtract(new TimeSpan(date1.Ticks));
That was a complicated way of getting the time difference... Just do like this:
TimeSpan ts = date2 - date1;
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
thanks
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
In SQL Server 2005 Express, I created a database the I right clicked to view the Properties then I went to Exended Properties. Now I have I have added a new Property called DBVersion and the value is 1.0
how can I read that property in my C# Windowx Application?
|
|
|
|
|
Hi,
I have a setup for MDI forms.
When I open an MDI client , i want the parent MDI opacity to be 50 % and back to 100 % when I close the client form.
My problem is that I am unable to access the Parent MDI form.
????????
Looking froward for your response.
Thank you!
Nauman
"Mess with the Best, Die like the rest"
|
|
|
|
|
you can set parent form opacity to be 50% after show the child form, and add event FormClosed on your child form, in that event set back parent opacity to 100%.
but...
when you set parent form opacity this will also affect to your child forms.
hope it helps
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
Dear Dhaim,
This is the plan i have in mind,
But Wht i am confused is
How can I access / change property of MID Parent while i am standing on MDI Chile.
Some sort of reference or something ??
Thx,
Nauman
"Mess with the Best, Die like the rest"
|
|
|
|
|
Two solutions both from the parent not the child.
1. Subscribe to the child's FormClosing event (in the parent form after creating the instance).
2. Use the parent form's MdiChildActivate[^] event - this is fired every time a child is opened or closed.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
M. Nauman Yousuf wrote: But Wht i am confused is
How can I access / change property of MID Parent while i am standing on MDI Chile.
use this.Parent.Parent from your MdiChildForm
hope it helps
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
Good Evening alL
I have an ASP.NET Front end that seaches the Dates in certain Ranges. here is my Data Layer.
public DataTable Get_Date_by_Month(String Username,String Datefrom, String Dateto)
{
con = new OleDbConnection(strcon);
DataTable Details = new DataTable();
da = new OleDbDataAdapter();
cmdselect = new OleDbCommand();
cmdselect.CommandTimeout = 0;
cmdselect.CommandText = "SELECT [Details].[Transportation],[Details].[HOUSING], [Details].[FEEDING], [Details].[UTILITIES], [Details].[INSURANCE],[Details].[TELECOMMUNICATION],[Details].[Entertainment],[Details].[FUEL],[Details].[CLOTHING],[Details].[EDUCATION],[Details].[Miscellaneous],[Details].[BASIC_INCOME], [Details].[OTHER_INCOME] FROM [Details] INNER JOIN USERS ON Details.[P_ID] = [USERS].[ID] Where Details.Username = ? And Details.[DATE] Between ? AND ? ";
cmdselect.CommandType = CommandType.Text;
cmdselect.Connection =con;
da.SelectCommand = cmdselect;
da.SelectCommand.Parameters.Add("[Username]", OleDbType.VarChar, 30).Value = Username;
da.SelectCommand.Parameters.Add("[DATE]",OleDbType.Date, 30).Value = Convert.ToDateTime(Datefrom).ToShortTimeString();
da.SelectCommand.Parameters.Add("[DATE]", OleDbType.Date, 30).Value = Convert.ToDateTime(Dateto).ToShortTimeString();
try
{
con.Open();
Details.Clear();
da.Fill(Details);
}
catch(OleDbException)
{
throw;
}
finally
{
con.Close();
}
return Details;
}
<pre>
but now if i try to Search between Valid Ranges, it Brings nothing to the DAtagrid. Am Using Access 2003
Thanks
<div class="ForumSig">Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http:
http:
vuyiswam@tshwane.gov.za
</div>
|
|
|
|
|
Vuyiswa Maseko wrote: da.SelectCommand.Parameters.Add("[DATE]",OleDbType.Date, 30).Value = Convert.ToDateTime(Datefrom).ToShortTimeString();
da.SelectCommand.Parameters.Add("[DATE]", OleDbType.Date, 30).Value = Convert.ToDateTime(Dateto).ToShortTimeString();
change those line to :
da.SelectCommand.Parameters.Add("[DATE]",OleDbType.Date, 30).Value = Convert.ToDateTime(Datefrom);
da.SelectCommand.Parameters.Add("[DATE]", OleDbType.Date, 30).Value = Convert.ToDateTime(Dateto);
hope it helps
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
Hi
i have this code to create a new control (inherites from Panel) and when user over it, click mouse and drag, a new rectangle create and resize to fit with mouse position cordination:
public partial class Stage : Panel
{
int originX = 0;
int originY = 0;
bool dragging = false;
public Stage()
{
InitializeComponent();
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
}
protected override void OnMouseDown(MouseEventArgs e)
{
this.dragging = true;
this.originX = e.X;
this.originY = e.Y;
Graphics g = this.CreateGraphics();
g.DrawRectangle(new Pen(Brushes.Red, 4), this.originX, this.originY, this.originX, this.originY);
this.Invalidate();
base.OnMouseDown(e);
}
protected override void OnMouseMove(MouseEventArgs e)
{
if (this.dragging)
{
int posX = e.X;
int posY = e.Y;
Graphics g = this.CreateGraphics();
g.DrawRectangle(new Pen(Brushes.Red, 4), this.originX, this.originY, posX, posY);
this.Invalidate();
}
base.OnMouseMove(e);
}
protected override void OnMouseUp(MouseEventArgs e)
{
if (this.dragging)
this.dragging = false;
base.OnMouseUp(e);
}
}
but at runTime, it work so bad with flicker and when mouse button released. not any rectangle exist in Stage control.
can anyBody help me to find out how to create rectangle whith drag and drop correctly ?
thanks
|
|
|
|
|
use BufferedGraphics object
see this link[^]
or
link[^]
hope it helps
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
Ok, first - don't draw using CreateGraphics. Override the OnPaint method, or register for the OnPaint Event.
Second, you can set double buffering on your form, which should reduce filcker (There should be a property on your form for this)
And the reason there is no rectangle when you've finished.. well, its because your no longer drawing any rectangle.
Rectangle rect = new Rectangle(0,0,0,0);
OnMouseDown(...)
{
this.dragging = true;
rect.X = e.X;
rect.Y = e.Y;
}
OnMouseUp(...)
{
this.dragging = false;
}
OnMouseMove(...)
{
if(this.dragging)
{
int width = e.X - this.rect.X;
int height = e.Y - this.rect.Y;
rect.Width = width;
rect.Height = height;
this.Invalidate();
}
}
OnPaint(...)
{
e.Graphics.DrawRectangle(myPen, rect);
}
Or something like that. You have to store the rectangle your creating, so that it can be drawn later on. It won't just stay there.
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Hey guys.
How can we write
if (str.Length > 250) str = str.Substring(0, 250);
with ? operator ?
Thank you.
|
|
|
|
|
The ? operator is like an if-else statement with the syntax:
Condition ? Statement1 : Statement2.
Where Statement1 is the code executed if the condition is true, and Statement2 is the code executed if the condition is false.
So in your situation, something like:
str = str.Length > 250 ? str.Substring(0,250) : str;
should do it.
Regards,
--Perspx
Don't trust a computer you can't throw out a window
-- Steve Wozniak
modified on Sunday, September 14, 2008 9:47 AM
|
|
|
|
|
Or
str = str.Substring(0, Math.Min(str.Length, 250));
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Perspx wrote: str = str.Length > 250 ? str.Substring(0,250) : str.Substring(0,str.Length);
The expression str.Substring(0,str.Length) is rather pointless, as it returns a string identical to str.
Just do:
str = str.Length > 250 ? str.Substring(0,250) : str;
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Yes, sorry, I noticed that after I posted.
Regards,
--Perspx
Don't trust a computer you can't throw out a window
-- Steve Wozniak
|
|
|
|
|
Hello ,
i'm using the office 2007 ribbon.. so i deleted the control bar by setting the Form Border Style to None.
So i can't drag-n-drop all the window now ...
i don't kno how can i tell the control to delegate the drag-n-drop event to the parent container ... ( the window )
i hope that my question is clear .. thank you.
ps : sorry for my bad english
modified on Sunday, September 14, 2008 7:36 AM
|
|
|
|