|
Thanks for the information!
I will try that.
Rado
|
|
|
|
|
Does anyone know how to add a progress bar to one of the panels of a status bar? I'm referring to a windows application of course. I'm stuck and I can't find anything on the code project about this.
Thanks
|
|
|
|
|
You use owner-drawing to place or draw a ProgressBar into a StatusBar or StatusBarPanel . It's not difficult, and if you search the message threads you'll find many examples posted in the past.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hi,
i need to put a string into byte[]. i can't find any "smarter" method to do.
currently, i do it in this way. suppose string like this "at+cmgl=4"
byte[] data = {(byte) 'a', (byte) 't', .... ,(byte) '4');
as i can't convert char[] to byte[], that's why i need to it in this way.
so, any better method to do it?
thanks,
jim
|
|
|
|
|
System.Text.Encoding.GetEncoding("ENCODING TYPE).GetBytes(mystring)
Cheers,
Venkatraman Kalyanam
Bangalore - India
"Being Excellent is not a skill, it is an attitude"
Reality is an illusion caused by caffeine deficiency(one Microsoft Research scholor)
|
|
|
|
|
Or even simpler:
System.Text.Encoding.ASCII.GetBytes(mystring) or
System.Text.Encoding.Unicode.GetBytes(mystring) . There are several other encodings you can use. Not only is it easier to type, but it also eliminates partial human error in case your forget an "I" in "ASCII" or something. This also results in faster calls within the CLR since parsing strings is extremely slow, and lookups would have to be performed before you got the actual Encoding object.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi,
Is it possible to extract the first day of a given week (an integer) from a given year??? I've managed to get the number of the week after a severe struggle with the DateTime class & DateTimeFormatInfo class, but could not find anything about getting the dates in that week...
Thanks...
|
|
|
|
|
I take it you are using the ISO definition of a week number? (That is, a week starts on a Monday and week 1 is the week that contains the first Thursday of the year.)
To calculate the date of the Monday for a given week number, you need to calculate the date of the Monday for week 1 and then add (7 * (weeknumber-1)) days to that date.
The easiest way to do that is to calculate the date of the first Thursday and then subtract 3 days.
To calculate the date of the first Thursday, calculate the day of the week for 1-Jan for that year. If it is a: Monday, add 3 days; Tuesday, add 2; Wednesday, add 1; Thursday, you got it in one; Friday, add 6; Saturday, add 5; Sunday, add 4.
So, amalgamating all that: calc DOW for 1-Jan. For each possibility, the Monday of week 1 will therefore be
If 1-Jan is a Monday, the Monday of week 1 is 1-Jan
If 1-Jan is a Tuesday, the Monday of week 1 is 31-Dec of previous year.
If 1-Jan is a Wednesday, the Monday of week 1 is 30-Dec of previous year.
If 1-Jan is a Thursday, the Monday of week 1 is 29-Dec of previous year.
If 1-Jan is a Friday, the Monday of week 1 is 4-Jan.
If 1-Jan is a Saturday, the Monday of week 1 is 3-Jan.
If 1-Jan is a Sunday, the Monday of week 1 is 2-Jan.
So, at that point it's simple. Good luck!
Cheers, Julian
Program Manager, C#
This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
|
|
|
That did the job! Thanks a lot!
Kaloyan
|
|
|
|
|
what happened to DateTime.DayOfWeek?
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Just to let you know I wrote a web article on calculating ISO week numbers:
http://www.boyet.com/Articles/PublishedArticles/CalculatingtheISOweeknumb.html
Cheers, Julian
Program Manager, C#
This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
|
|
|
What's different between System.ComponentModel.Component and System.Windows.Forms.Control? When will me use the Component but not the Control in design?
Thanks.
Game is power!
|
|
|
|
|
If you looked at the documentation, you'd see that a Component (or other IComponent implementation) is anything that can be contained with in a container, or more specifically IContainer . The biggest difference? A Control is graphical and has concepts such as location and size, where a Component isn't necessarily graphical.
Take the FileSystemWatcher for example. It obviously has no UI associated with it since it just watches files and uses Win32/NT-based APIs. It does, however, have an icon associated with it in design-time. This is because it's a component and can be dragged and dropped onto the design surface. This allows code monkeys to click on it and set properties and event handlers using VS.NET (or any other emerging designer these days). You can, of course, forget about the whole component architecture and type it manually, but this allows the component to be "designed".
So, when should you use a control and when should you use a component? If you plan on displaying any UI, you must inherit from control since only controls in the parent's Controls collection are displayed - and it only takes a Control or a child class of it.
If you want your "object" to be tied to a designer (even extending the designer with your own ComponentDesigner ), you can make it derive from Component . .NET has several examples, such as the FileSystemWatcher , the EventLog , and many, many more. Just go to the overview documentation for the Component class and click on "Derived Classes" toward the top of the page.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I did somethings here :
1. c:\>runread.exe a.txt c.txt
2. Read a.ok
3. c = a = 20
4. c:\>
runread.exe is programed on c++ and compiled into exe file, I run it with some paramaters. As a result is to write what it read from a.txt and compare a.txt and c.txt.
I want to write a c# file to read what it print. How to read result from command line ???
|
|
|
|
|
static void Main(string[] args)<br />
{<br />
string firstFilename = args[0];<br />
string secondFilename = args[1];<br />
}
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Philip Fitzsimons wrote:
static void Main(string[] args)
{
string firstFilename = args[0];
string secondFilename = args[1];
}
I guess you have a sore thum while trying to write
<br />
Console.WriteLine("First arg = {0}, second arg = {0}", firstFilename, secondFilename); <br />
<br />
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
nah, just did not want to do all of his homework...
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
hi, i want to make chart like barchart/piechart in C#..is there any class available for that..so, i can just give data and type of graph ..it will be automatically created..its for academic purpose..so, third party controls are not allowed...can i use MSChart..if yes, then how can i use..? can anybody say? thanx in advance..
-bhavin
|
|
|
|
|
Yes, you can use MSChart. Just add it to the toolbox the same way you'd add any other control.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
thanx for the reply..but m not using Visual Studio .NET IDE. m using SharpDevelop for development. and there is no option to add ocx(component) in toolbox as per my knowledge..so, i can use it..pls tell me..and isn't there any class to create the graphs?
-Bhavin
"A winner is not one who never fails, but one who NEVER QUITS!" -Bhavin
|
|
|
|
|
Ahh, SharpDevelop! That's what I use. If you can wait a week or 2, the next version will have full support for ActiveX and custom controls. (I'm a SharpDevelop contributor, so I have access to the current internal build, but unfortunately they are in the middle of changing the parser, so the forms designer is inoperable.) Or you could add it to your form manually, and just not use the forms designer.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
you wrote:
>Or you could add it to your form manually, and just not use the forms >designer.
But how can i add it ? could u give me the code snippet or some guidlines..
m asking also why any type of class support is not available in C#..if i don't want to use control then?
-Bhavin
|
|
|
|
|
hi, i tried to add MSChart from Add References but it gives me following error..and doesn't allow to add control...so, any how its possible or not? if yes then pls tell me how it is in details?
-bhavin
System.Runtime.InteropServices.COMException (0x80029C4A): Error loading type library/DLL.
at ICSharpCode.SharpDevelop.Internal.Project.TypelibImporter.LoadTypeLibEx(String strTypeLibName, RegKind regKind, Object& typeLib)
at ICSharpCode.SharpDevelop.Internal.Project.TypelibImporter.Import(ProjectReference refinfo, IProject project)
at ICSharpCode.SharpDevelop.Internal.Project.ProjectReference.GetReferencedFileName(IProject project)
at ICSharpCode.SharpDevelop.Services.DefaultParserService.AddReferenceToCompletionLookup(IProject project, ProjectReference reference)
at ICSharpCode.SharpDevelop.Commands.ProjectBrowser.AddReferenceToProject.Run()
at ICSharpCode.Core.AddIns.Codons.MenuEventHandler.Execute(Object sender, EventArgs e)
at Crownwood.Magic.Menus.MenuCommand.OnClick(EventArgs e)
at Crownwood.Magic.Menus.PopupMenu.InternalTrackPopup(Boolean selectFirst)
at Crownwood.Magic.Menus.PopupMenu.TrackPopup(Point screenPos, Boolean selectFirst)
at Crownwood.Magic.Menus.PopupMenu.TrackPopup(Point screenPos)
at ICSharpCode.SharpDevelop.Gui.Pads.ProjectBrowser.ProjectBrowserView.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.TreeView.WmNotify(Message& m)
at System.Windows.Forms.TreeView.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
|
|
|
|
|
hi, i tried to add MSChart from Add References but it gives me following error..and doesn't allow to add control...so, any how its possible or not? if yes then pls tell me how it is in details?
-bhavin
System.Runtime.InteropServices.COMException (0x80029C4A): Error loading type library/DLL.
at ICSharpCode.SharpDevelop.Internal.Project.TypelibImporter.LoadTypeLibEx(String strTypeLibName, RegKind regKind, Object& typeLib)
at ICSharpCode.SharpDevelop.Internal.Project.TypelibImporter.Import(ProjectReference refinfo, IProject project)
at ICSharpCode.SharpDevelop.Internal.Project.ProjectReference.GetReferencedFileName(IProject project)
at ICSharpCode.SharpDevelop.Services.DefaultParserService.AddReferenceToCompletionLookup(IProject project, ProjectReference reference)
at ICSharpCode.SharpDevelop.Commands.ProjectBrowser.AddReferenceToProject.Run()
at ICSharpCode.Core.AddIns.Codons.MenuEventHandler.Execute(Object sender, EventArgs e)
at Crownwood.Magic.Menus.MenuCommand.onclick(EventArgs e)
at Crownwood.Magic.Menus.PopupMenu.InternalTrackPopup(Boolean selectFirst)
at Crownwood.Magic.Menus.PopupMenu.TrackPopup(Point screenPos, Boolean selectFirst)
at Crownwood.Magic.Menus.PopupMenu.TrackPopup(Point screenPos)
at ICSharpCode.SharpDevelop.Gui.Pads.ProjectBrowser.ProjectBrowserView.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.TreeView.WmNotify(Message& m)
at System.Windows.Forms.TreeView.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
|
|
|
|
|
use the axhost utility to create a .net wrapper around the component then reference that assembly
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|