|
You want to create custom controls ? OK, off you go then.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello, I need to show thumbnails for lets say, 4000 .jpg files in a SD card, is there a simple way to read the thumbnail embedded in the Exif of the JPEG file header.
I'm asking this 'cause calling Image.GetThumbnailImage is gonna take forever
thanks
|
|
|
|
|
|
That seemed pretty cool the thing is, it is still too slow.
I set the folder view to thumbnails in Windows Explorer and it takes forever to display the thumbnails.
Right now I'm testing that, and after 10 min, only 3 thumbnails have been shown.
I need something to extract the JPEG exif thumbnail.
but thanks
|
|
|
|
|
Hi folks -
This is my first post here, though I've gained some excellent knowledge by searching the site in the past.
I am having a problem with a Word-based mail merge in a C# Windows form application. The problem has to do with the Normal.dot template.
At a high level, my app copies a Word dot template file (not named Normal) to a temp directory, and performs a merge with a data file. If I wanted to save the newly-merged doc file at this point and then close Word entirely there would be no problem.
But, I need to keep the newly-created merged content doc file open. Right now, here’s what happens:
The merge takes place, my app ends, and you are left viewing the new doc file in Word.
At this point, you can either “Save As” with this new doc then exit Word, or just exit Word without saving the new doc – the following occurs either way.
A message box appears: “The file is in use by another application or user. (C:\Documents and Settings\...\Normal.dot)”.
Click OK (the only choice) and a “Save As” pane appears referring to Normal.dot.
Click on “Cancel” (because I don’t want to save Normal.dot) and you’re looking at a empty instance of Word.
Click the red X or choose File/Exit and a message box appears: “Changes have been made that affect the global template, Normal.dot. Do you want to save these changes?”
Select “No” and Word finally closes.
Again, if I just wanted to have the app save my new doc then shut down Word this would be easy. But how can I kill whatever has attached itself to Normal.dot while leaving my new doc open in Word? I don’t want the users to have to deal with making choices about the Normal.dot file. Again, the dot I use in the merge is not Normal.dot…
Thanks for any insight about this problem…
Frank
|
|
|
|
|
Well, I'm pleased to say that making one last Google search I finally found the answer to this problem. Here it is in case it can help anyone else out. The answer was found here:
*****
http://support.microsoft.com/kb/285885
Before you quit Word or transfer control to the user, set the Saved property of the Normal.dot template to True as follows:
Application.NormalTemplate.Saved = True
*****
That in effect makes Word think that the Normal.dot template has already been saved, so it now does not complain about it as Word closes. I verified the creation/edit time of the Normal.dot file in my Microsoft Templates folder to make sure it was truly not changed. This looks like the fix!
Frank
|
|
|
|
|
Frank,
Just wanted to thank you for this post, it helped me out a bunch with an app that I wrote parsing apart specified word files. I was getting very frustrated about Word not closing until I found your post.
Thanks a million
Greg
|
|
|
|
|
Using .Net 2, is there a way to determine if a date in the past falls under DST for a specific time zone using the DST rules for the year of the date. For example, if I have April 2, 2004, I would like to determine if I should be using DST using the 2004 rules for Eastern Time (GMT -5). It doesn't appear that .Net has anything that support this, and I can't tell if Windows even supports this for dates in the past. I know how to do this for current dates.
|
|
|
|
|
Yes, well sort of.
See DateTime.Kind[^]
However you might also read this[^] as it explains that there is no correct conversion.
|
|
|
|
|
Hi,
I am using an IDataReader with SQL and ASP.Net. I keep getting an IndexOutOfRangeException because in one of the columns there is only a value for some of the rows (ex. if the size is over 0.5 there is a value, but if it is 0.5 or under that column is blank). How can I do this?
So far I have:
public static List<name> GetAllNames(){
SqlDatabase db = DatabaseFactory.CreateDatabase() as SqlDatabase;
DbCommand cmd = db.GetStoredProcedureCommand("dbo.GetAllNames");
List<names> namelist= new List<name>();
using (IDataReader reader = db.ExecuteReader(cmd))
{
while(reader.Read())
{
namelist.Add(GetNameFromReader(reader));
}
}
return namelist;
}
private static Name GetNameFromReader(IDataReader reader)
{
Name name_obj = new Name(
(int)reader["ID"],
((reader)["size"] !=DBNull.Value)? (int)reader["size"] : (int)0));
return name_obj;
}</name></names></name>
Thanks so much for your help!
|
|
|
|
|
The code looks OK. I don't see why you'd get IndexOutOfRangeException for some rows but not others.
|
|
|
|
|
Terick wrote: (reader)["size"]
I am not getting this?
By the way try this:
private static Name GetNameFromReader(IDataReader reader)
{
Name name_obj = new Name(
(int)reader["ID"],
(reader["size"] != DBNull.Value)? (int)reader["size"] : (int)0);
return name_obj;
}
Be careful, there is no Undo Button(Ctrl+Z) in life.
|
|
|
|
|
|
Terick wrote: otherwise the cell will be empty
Hmm.... Now i get it.
string.IsNullOrEmpty(reader["size"]) ? 0 : (int)reader["size"]
|
|
|
|
|
Hi,
Ever used the old DataGrid control "not the DataGridView" and wanted to add a comboBox column?? Well, I'm trying to do so and according to many websites they have it under System.Windows.Forms namespace but I just cant find it in the intelisense....
Pleeeeeeeeeez help guys!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi,
I had a quick rummage in the MSDN library. It reports that that control isn't in the System.Windows.Forms namespace, but instead is in Microsoft.CLRAdmin. It's also marked as 'This class supports the .NET Framework infrastructure and is not intended to be used directly from your code.' This suggests to me that if what you want to do is possible, it has to be done another way. Perhaps there is a method on one of the other DataGridView classes to add it for you.
I'm sorry this doesn't really solve your problem, but it does answer your question
Also, a free tip: Adding things like
Muammar© wrote: Pleeeeeeeeeez help guys!
won't help you get an answer. The people on this site seem to generally quite helpful, so you don't need to beg, and comments like that can be seen as annoying (particularly the spelling of 'please').
|
|
|
|
|
I'm currently in the process of refactoring a web app to make it more testable and have posted here about it.
I've managed to move forward a lot but now I'm in the situation where I perform the dependency injection on the constructor or via setting properties and the number of items needed is increasing e.g. Membership, state management, meta data provider etc.
Although I could look at using static classes within the assembly I need to provide the implementation to be used from outside the assembly e.g. web app creates instance of class providing the relative dependancies and I am also concerned about the testability of static classes.
Any suggestions about approaches I could take or patterns I could follow would be greatly appreciated.
|
|
|
|
|
Some cross-cutting concerns can be aggregated into "context", which is usually globally accessible. Think of HttpContext...you can access it anywhere via HttpContext.Current. Think of context from a grammatical perspective...certain words or phrases only have meaning when they are taking "in context". Same general idea with programming. A piece of code really only works when you factor in the appropriate context(s). Not everything needs to be injected, some things should be globally accessible via one or more contexts. This might help lighten your DI load so that you are only injecting direct dependencies of each class, while keeping global dependencies properly centralized.
|
|
|
|
|
DateTime dateRented = rental_InvoiceTableAdapter1.getTimeRentedbyInvoiceNo(int.Parse(txtInvoiceNo.Text));
I can't figure out why I'm getting this exception thrown by this code. I'm trying to collect a single cell from the DateTime column "Time_Rented" using a SQL statement. The SQL statement works fine in the query builder, so it has to be something in the C# code.
The entire error message is:
"Cannot implicitly convert type 'System.DateTime?' to 'System.DateTime'. An explicit conversion exists ( are you missing a case?)"
Both sides of the statement are DateTime, aren't they? I don't understand why it can't convert it.
Please help!
|
|
|
|
|
Lodeclaw wrote: System.DateTime?
What is System.DateTime? ?
I have only heard of System.DateTime .
Try removing the "?".
Kristian Sixhoej
"You can't undo the past... but you can certainly not repeat it." - Bruce Willis
HAI
CAN HAS STDIO?
PLZ OPEN FILE "SIGNATURE.TXT"?
AWSUM THX
VISIBLE FILE
O NOES
INVISIBLE "ERROR!"
KTHXBYE
|
|
|
|
|
That's confusing me, as well. I didn't type System.DateTime? anywhere. If I had typed it incorrectly the debugger would have notified me when I typed it. I'll do a search for it, anyway.
|
|
|
|
|
It's a nullable datetime. int? is a nullable int, for example.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Look closely at the message. DateTime? is a nullable DateTime. You'll have to do the explicit conversion
[EDIT] or alternatively declare you date rented as the nullable DateTime? type.
Alan.
|
|
|
|
|
I've been trying to do the explicit conversion. How do I know what the explicit conversion is? I've tried DateTime.Parse the query results as a string and I've tried Convert.DateTime . Can you offer any other possibilities?
|
|
|
|
|
DateTime? is short-hand for Nullable<DateTime> , using the Nullable<T> class introduced in .NET Framework 2.0. The Nullable types are actually a class that is a wrapper around a value type. To get the underlying value from a Nullable<T> , use the Value property like so:
DateTime dateRented = rental_InvoiceTableAdapter1.getTimeRentedbyInvoiceNo(int.Parse(txtInvoiceNo.Text)).Value;
Or you can declare dateRented as Nullable<DateTime> (same as DateTime? ) rather than a normal DateTime , like so:
DateTime? dateRented = rental_InvoiceTableAdapter1.getTimeRentedbyInvoiceNo(int.Parse(txtInvoiceNo.Text));
OR
Nullable<DateTime> dateRented = rental_InvoiceTableAdapter1.getTimeRentedbyInvoiceNo(int.Parse(txtInvoiceNo.Text));
The message really means that the getTimeRentedbyInvoiceNo() function is returning a DateTime? and you are trying to stuff that return value into a DateTime ; and they are two different types.
Hope in one hand and poop in the other; see which fills up first. Hope and change were good slogans, now show us more than words.
|
|
|
|