|
You are right. I hadn't considered that a Form was a Control. I'll just use Control TargetControl in my signature, and simply do
TargetControl.Controls.Add(myCustomControl)<br />
Thanks, everybody.
|
|
|
|
|
Hello there!
I have three problems while working on the application in Visual Studio 2005 in c#. 1st. i want to ask that i want to display the system date and time on my form but in the format like [month] [day] [year] and [time] but sepratly not like month/day/year as i want to save them sepratly in the database table fields not in the same field can any one help me how i can do it? 2nd. i want to set any form as start up form how can i do it? 3rd. i want to introduce the crystal report in my application please tell me wht the steps are there to follow ?
|
|
|
|
|
1) Use a Label? Then label.Text=System.DateTime.Now.ToString ( "MM dd yyyy HH:mm" ) or some other format, look 'em up.
2) Add the exe to the user's Startup?
3) Invite your app and Crystal to a party, introduce them there.
|
|
|
|
|
3. Not recommended. I invited Crystal to a party once and I still haven't found my cat!
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
But did you find hers?
|
|
|
|
|
thanks alot for the response but i have tried this alot many times but i dont want to have the date time information in one label i want date in one label month in the seprate label so that i can save them in seprate attirbutes in the database. and please kindly eleborate yours reply for my problem 2 i did't get yours point....
|
|
|
|
|
Seems wasteful.
I'm not even sure what you mean in 2 -- do you mean you want the app to startup when a user logs in?
|
|
|
|
|
its not waste full becuase i want the date format in sperate labels becuase while working with the Inventory application sale portion i have a requirement to view the record of all sale in the spcified month so thats y month in seprate coloumn of SQL is must.
And in 2nd point i want to put the winForm in start up becuase after creating each form i want to see its out look by running it.
|
|
|
|
|
How it looks on screen has very little to do with how it's setup in the database.
Oh, so that's what you mean. In the Solution Explorer, right-click a project, and select "Set as StartUp Project". But the project has to be an exe, not dll. And the form has to be the main form of that exe.
|
|
|
|
|
thank u very much i have sorted out the problem for start up can u please tell me that wht will i have to do put the date month and year seprate fields in the database ?
|
|
|
|
|
No I will not, it's a bad idea.
|
|
|
|
|
Is anybody aware of a bug (and a fix) in VS 2005 SP1 that generates errors in datasets when adding an insert/update/delete query. The error is "reference is not set to an instance of an object" (usually line 1) and is generated because the "Name" attribute is not saved in the xml file.
Sometimes, simply loading the dataset in Visual Studio, and saving it clears all the "Name" attributes in the xml; and this has happened on multiple computers.
Mihai,
|
|
|
|
|
hi there,
i m making an app that need to decompress Zlip file from File data in byte[] in a specified format
i.e.
char {4} - Header (l33t)
uint32 {4} - Decompressed File Size
byte {X} - ZLib Compressed File Data
// WHEN DECOMPRESSED
char {2} - Header (BG)
uint32 {4} - Archive Size [+8]
byte {X} - Unknown
to read this file, i created a binary reader and read what i can but i m unable to decompress it
the codes to read :
BinaryReader br = new BinaryReader(File.Open(@"C:\Documents and Settings\xmen\Desktop\g.age3scn", FileMode.Open));
string header = new string(br.ReadChars(4));
int filesize = br.ReadInt32();
byte[] filedata = br.ReadBytes(filesize);
can someone tell me how can i decompress it?
Becoming Programmer...
|
|
|
|
|
Have you tried Google[^] to look for a .NET wrapper around the zlib libraries?
|
|
|
|
|
What is this Google you speak of?
|
|
|
|
|
It's this new-fangled contraption that automagically gives you the answer to any question you ask. I know, it's heresey, isn't it?
|
|
|
|
|
And it really works[^]...
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
|
|
|
|
|
yep, but didnt find anything about Zlib
Becoming Programmer...
|
|
|
|
|
|
opps..!! i forgot to click on it
Becoming Programmer...
|
|
|
|
|
I have myObject and I want to know whether it is an instance of ICollection<T> for some unknown T. In simple cases, this might suffice:
myObject.GetType().GetGenericArguments()
However, I have many classes like this:
class XCollection : MySuperCollection<X>
class YCollection : MySuperList<Y>
So myObject's immediate type may not have any generic arguments. Remembering that one class my implement ICollection<T> for many types T, I'd like a method like this:
/// <returns>
/// The value of GetGenericArgs(), a Type[], for each specific type of the
/// given genericType that is implemented by subType.
/// </returns>
Type[][] GetGenericArgs(Type genericType, Type subType)
Which could be used like this:
Type[][] elementTypes = GetGenericArgs(typeof(ICollection<>), myObject.GetType())
// elementTypes == new Type[][] { new Type[] { typeof(X) } };
One way is to require genericType to implement ICollection<>, check for methods named 'GetEnumerator', get each possible T implied by these methods, and then check whether myObject is an instance of ICollection<T> for each specific possibility. I can implement this, and I'm sure it will work, but it's Wrong. Is there an appropriate way to do this?
|
|
|
|
|
Are you trying to determine if it implements ICollection<T> or a concrete instance of ICollection<T> (say ICollection<int> )?
You could try using the <a href="http://msdn2.microsoft.com/en-us/library/system.type.isassignablefrom.aspx">IsAssignableFrom</a>[<a href="http://msdn2.microsoft.com/en-us/library/system.type.isassignablefrom.aspx" target="_blank" title="New Window">^</a>] method to determine if it implements any ICollection<T> or the IsGenericType[^] property?
You could also take a look at the ContainsGenericParameters[^].
|
|
|
|
|
I'm trying to determine if it implements ICollection<>, not a specific type like ICollection<int>.
IsAssignableFrom is a nice magical method, but it only works for specific types.
Anyways, I think I found the right way to do what I want (after, of course, putting my question in a public space...). Thanks for your help. Here's my solution, and the problem stated in sharper terms:
Supposing type X as follows,
class X
{
private class WackyClass<T> : ICollection<T>, IList<int> { }
private class XList : WackyClass<string> { }
static public readonly object Data = new XList();
}
Implement this method, which has no access to X's private types:
/// <example><code>
/// Type[][] args = GetGenericArgs(X.Data, typeof(ICollection<>));
/// Assert(args == new Type[][] {new Type[] {typeof(string)}, new Type[] {typeof(int)}});
/// </code></example>
Type[][] GetGenericArgs(Type subType, Type genericType);
Here is an implementation I feel much better about
if (genericType.IsGenericTypeDefinition == false)
if (genericType.IsGenericType && genericType.IsAssignableFrom(subType))
return new Type[][] { genericType.GetGenericArguments() };
else
return new Type[][] { };
else
{
IEnumerable<Type> candidates;
if (genericType.IsInterface)
candidates = subType.GetInterfaces();
else
candidates = Iterators.Traverse<Type>(subType, "BaseType");
List<Type[]> result = new List<Type[]>();
foreach (Type candidate in candidates)
if (candidate.IsGenericType && candidate.GetGenericTypeDefinition() == genericType)
result.Add(candidate.GetGenericArguments());
return result.ToArray();
}
|
|
|
|
|
I have a window that when it is minimized it is displayed in system tray. The problem is that from time to time I have to show different messages via a messagebox and the message box doesn't appear. When the window is maximized the messageboxes appear.
I am fighting against the Universe...
Reference-Rick Cook
|
|
|
|
|
You need to display the message box on the desktop. You can do this with this overload of the Show()[^] method. This overload allows you to specify additional options[^]. You want to specify the DefaultDesktopOnly option and (I think) pass null for the owner.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|