|
|
|
I konw this method,but that ont isn't what I want.and thank you advance.
I will look for a new method to deal with this question.
你懂汉语吗?
|
|
|
|
|
I want to replace the double backslash with a single backslash. The following code does not work.
pResult.Path = pResult.Path.Replace(@"\\", @"\");
It does not do any replacement at all. How can this be accomplished?
|
|
|
|
|
That should work as is. If you're looking at it in the watch window, be mindful that Visual Studio already escapes special characters with a slash. If you click on the magnifying glass (the visualizer), you should be able to see the 'unescaped' version of the string.
|
|
|
|
|
You are right, it did work. Thanks for the clarification.
|
|
|
|
|
Getting the data from the tags of a TIFF image
I'm trying to make a program that opens a TIFF image and puts the data from the tags in texboxs but I do not know how to extract the data. If anyone knows how can help me.
thanks
|
|
|
|
|
Hi,
here is some code I've been using for that purpose, it was aiming at JPEG though:
FileStream stream=new FileStream(fileSpec, FileMode.Open, FileAccess.Read);
Image localImage2=Image.FromStream(stream);
#if true
int[] piList=localImage2.PropertyIdList;
Dictionary<int, string> propNames=new Dictionary<int,string>();
propNames.Add(0x010E, "ImageDescription");
propNames.Add(0x010F, "EquipMake");
propNames.Add(0x0110, "EquipModel");
propNames.Add(0x0112, "Orientation");
propNames.Add(0x011A, "XResolution");
propNames.Add(0x011B, "YResolution");
propNames.Add(0x0132, "DateTime");
propNames.Add(0x0128, "ResolutionUnit");
propNames.Add(0x0131, "SoftwareUsed");
propNames.Add(0x0201, "JPEGInterFormat");
propNames.Add(0x0202, "JPEGInterLength");
propNames.Add(0x0213, "YCbCrPositioning");
propNames.Add(0x501B, "ThumbnailData");
propNames.Add(0x502D, "ThumbnailResolutionX");
propNames.Add(0x502E, "ThumbnailResolutionY");
propNames.Add(0x5090, "LuminanceTable");
propNames.Add(0x5091, "ChrominanceTable");
propNames.Add(0x829A, "ExifExposureTime");
propNames.Add(0x9003, "ExifDTOrig");
propNames.Add(0x9004, "ExifDTDigitized");
propNames.Add(0x9204, "ExifExposureBias");
propNames.Add(0x9209, "ExifFlash");
propNames.Add(0x927C, "ExifMakerNote");
propNames.Add(0x9286, "ExifUserComment");
propNames.Add(0xA002, "ExifPixXDim");
propNames.Add(0xA003, "ExifPixYDim");
foreach (int ID in piList) {
if (propNames.ContainsKey(ID)) getPropertyItem(localImage2, ID, propNames);
}
#endif
localImage=new Bitmap(localImage2);
stream.Close();
localImage2.Dispose();
and
protected void getPropertyItem(Image image, int ID, Dictionary<int, string> propNames) {
string s=(string)propNames[ID];
if (s==null) s="";
s+=new string(' ', 20);
s=s.Substring(0, 20);
string name="Prop"+LP_Format.Hex4(ID)+" "+s;
string type=null;
try {
PropertyItem pi=image.GetPropertyItem(ID);
s="";
byte[] bb=pi.Value;
switch ((PropertyTagType)pi.Type) {
case PropertyTagType.Byte:
type="(byte)";
for (int i=0; i<bb.Length; i++) {
byte us=bb[i];
s+=" "+us.ToString("X2");
if (bb.Length==1) s+="("+us.ToString()+")";
}
break;
case PropertyTagType.ASCII:
type="(ASCII)";
s=" "+ASCIIencoding.GetString(pi.Value, 0, pi.Len-1);
break;
case PropertyTagType.Short:
type="(short)";
for (int i=0; i<bb.Length/2; i++) {
ushort us=BitConverter.ToUInt16(bb,2*i);
s+=" "+us.ToString("X4");
if (bb.Length==2) s+="("+us.ToString()+")";
}
break;
case PropertyTagType.Long :
type="(long)";
for (int i=0; i<bb.Length/4; i++) {
ulong us=BitConverter.ToUInt32(bb,4*i);
s+=" "+us.ToString("X8");
if (bb.Length==4) s+="("+us.ToString()+")";
}
break;
case PropertyTagType.Rational:
type="(rational)";
for (int i=0; i<bb.Length/8; i++) {
uint uNominator=BitConverter.ToUInt32(bb, 8*i);
uint uDenominator=BitConverter.ToUInt32(bb, 8*i+4);
s+=" "+uNominator.ToString()+"/"+uDenominator.ToString();
}
break;
case PropertyTagType.Undefined:
type="(undefined)";
for(int i=0; i<bb.Length; i++) {
s+=" "+bb[i].ToString("X2");
}
break;
case PropertyTagType.SRational:
type="(srational)";
for (int i=0; i<bb.Length/8; i++) {
int uNominator=BitConverter.ToInt32(bb, 8*i);
int uDenominator=BitConverter.ToInt32(bb, 8*i+4);
s+=" "+uNominator.ToString()+"/"+uDenominator.ToString();
}
break;
}
if (type==null) type="?"+pi.Type+"?";
env.log(0, name+LP_String.Extend(type, 12)+s);
} catch (Exception exc) {
env.log(0, "Unable to obtain "+name+"; "+exc.Message);
}
}
Hope this helps.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi,
I'd a DataTable where I'd filled the data using SQL Statement "SELECT CONVERT(VARCHAR,DOB,105) AS DOB FROM TABLENAME".
Here the DataTable is filled with Dates by using the format "dd-MM-yyyy"
My problem is I need to apply the Filter viz., =, >, >=, <, <= on the DataTable based on the input given by the user in the same format "dd-MM-yyyy" irrespective of the datetime setting in the user system.
Can any one suggest on this.
Thanks in Advance
Sreedhar Kadiyala
|
|
|
|
|
In your select statement include a where clause the would be a built string based on the input the user entered. For example:
"WHERE mydate < CONVERT(DATETIME, '" + "07/01/2009" + "00:00:00', 103)"
Replace 07/01/2009 with logic that would build that part of the string based on the user inputs.
|
|
|
|
|
Hi,
Take the input from the user which would be in the form of '=, >, >=, <, <=' and the string with this try to make a filter condition and apply it to the rowFilter of the dataview.You will surely get..
Regards
Anju
|
|
|
|
|
Hi,
I can't see what's wrong with this code. I am getting "1/2/2009 9:00:00 AM" displayed in the textBox when I'm expecting "1/2/2009 9:00:00 PM". Can anyone tell me what I'm doing wrong here, please?
DateTime dateTime;
DateTime.TryParseExact("1/2/2009 9:00 PM", "d/M/yyyy H:m tt", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime);
textBox1.Text = dateTime.ToString();
I'm using VS2008 and targeting .NET 3.5 and have "en-AU" as the default Windows culture.
Thanks, Henk.
|
|
|
|
|
|
Thanks stancrm, I was reading up on the "g" you used and that led me to Custom Format Strings at http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx[^] where I realised I should be using h instead of H if I'm wanting to parse the AM/PM part. Thanks for assisting. Regards, Henk.
|
|
|
|
|
Hi,
Please let me know how to add a filter for DataGridView so that the user can enter the filter condition in the corresponding column header to filter the rows that match the condition.
I am new to C#. Requirement is simillar to how it is in Mercury Quality center or TestDirector tools.
Hope the question is clear..
Thanks & Regards,
Dhana
modified on Tuesday, August 11, 2009 8:29 AM
|
|
|
|
|
Hi,
Since the DataTable source is assigned to DataGridView, you can filter the DataTable by using
DataTable.DefaultView.RowFilter="ColName=" + ColValue
It will automatically apply to the DataGridView
Sreedhar
|
|
|
|
|
Thanks very much..i am now using the simillar code for implementing the filter.
Thanks & Regards,
Dhana
|
|
|
|
|
If this is a bound DataGridView, you are not allowed to add rows. Hence you will need to extend the DataGridView if you need a filter like Quality center.
A quick and dirty (and may be "not recommended") way is:
1. Provide padding the headercell.
2. Add a textbox to the DataGridView at the location right above the first row.(You will need to play with the location of the textbox)
3. Handle its TextChanged event and set the RowFilter property of the datatable you have.
A better solution IMO will be to have a button and display a modal window where in user can apply filter.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Thanks very much..I have followed the steps that you have given and created it..as you said it is ugly..it seems the same to me..I am trying to make it more clean.
Thanks & Regards,
Dhana
|
|
|
|
|
Does DataGridView Filter Popup[^] help?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I think this is wanted i actually wanted..thanks very much..I trying to incorporate this framework. Thanks very much..it has really helped me ..
Thanks & Regards,
Dhana
|
|
|
|
|
Hi All,
I am having problems adding a new row to a datagridview control in my form. I have a simple form
a datagridview. When the user types in an item number at columen one , the system will populate the datagridview with the relevant data from the database.
|
|
|
|
|
how far have you tried... can you send the code ....
|
|
|
|
|
mohammad alnoed wrote: a new row to a datagridview control in my form
Try out the following code -
dataGridView1.AlloUserToAddRows = True;
Keep me posted if this resolves your problem.
|
|
|
|
|
Take a look at this[^] thread. Although it is about a ComboBox in a DGV the same principle can be applied to hooking an event for a DataGridViewTextBox (or whatever you are using). All you have to do is decide which event is most appropriate for your needs.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|