|
You are confusing encoded data with character codes. They are not the same.
When you are reading the byte values from the file, you are getting encoded data.
When you are getting the character codes from a string, you are getting decoded unicode character codes. The character codes are 16 bit values, not 8 bit values.
How are you displaying the character codes? As they are 16 bit value, they will not fit in a two-character hex code. Are you certain that the character in question really has the character code C7 and not for example 48C7?
Do you have any problem with the values that you read, besides that the encoded bytes and the decoded characters are different?
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi.
Thanks for the help, sorry about the confusion this is basically what I am doing. The .dbf file is an old ASCII 8bit file and this is what I am getting if I open up in a HexEditor.
79 77 77 78 80 7D 77 7F 77 7D 79 79 77 7F 7E
This information has been 'scrambled' by an increase in the character code. The file may or may not be scrambled, the idea of the program is for the user to check if it is and to choose to unscramble if they want to.
My program links to the database as below and assigns the strSample[0] to a textbox so the user can see if it is junk or an ID number as it would be if not scrambled.
string[] strSample = new string[3];<br />
strSample[0] = dBaseDataReader.GetString(dBaseDataReader.GetOrdinal("Col1name"));<br />
strSample[1] = dBaseDataReader.GetString(dBaseDataReader.GetOrdinal("Col2name"));<br />
strSample[2] = dBaseDataReader.GetString(dBaseDataReader.GetOrdinal("Col3name"));
When looking in the textbox the the information when scrambled looks ok but when check the character code of each character in the text box and display in a debug.
<br />
string DebugString = "";<br />
for (int i = 0; i < strSample[0].Length; i++)<br />
{<br />
DebugString += MarkGwilliam.com.Framework.Convert.Converter.DecToHex.Convert(((int)strSample[0][i]).ToString())+ " ";<br />
<br />
}<br />
System.Diagnostics.Debug.Write(DebugString);
I am getting
79 77 77 78 C7 7D 77 7F 77 7D 79 79 77 7F 7E
The strange thing is that it is even showing as a different character in the text box to in HexEditor or notepad, in there I can see the character (hex) 80 as Euro currency symbol but the character in my textbox seems to be Ç. If i actually type into the textbox with the old alt-128 trick then it does (the same as in this post) show Ç so how is it that when I ask for the decimal int for this character I am getting 199 instead of 128?
Confused!!!
Tony
|
|
|
|
|
tg2004 wrote: The strange thing is that it is even showing as a different character in the text box to in HexEditor or notepad, in there I can see the character (hex) 80 as Euro currency symbol but the character in my textbox seems to be Ç. If i actually type into the textbox with the old alt-128 trick then it does (the same as in this post) show Ç so how is it that when I ask for the decimal int for this character I am getting 199 instead of 128?
You are still confusing byte values with unicode character codes. When you read the database file and get the value as a string, it's decoded from bytes into unicode character codes. Those are completely different in meaning, and you can't compare them.
What I think is confusing you is that the ASCII codes between 32 and 126 represent the same characters in the unicode character set. That is just a design decision for the layout of the characters in the uncide character set. The character codes in unicode could just as well have been completely different from the ASCII codes.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi there,
I've got a standard RTF control and am coding a basic text formatter.
In the event the user selects a section of text which has multiple fonts contained in it, SelectionFont will return null - that's documented and accepted behaviour.
However - how do I now set the font for the selected text to the new font in that case?
All the examples I've found use variations on the theme of:
richTextBox1.SelectionFont = new Font(
currentFont.FontFamily,
currentFont.Size,
newFontStyle);
which clearly won't work if richTextBox1.SelectionFont == null.
Please help!
Kind regards,
John.
|
|
|
|
|
Hi,
you can set it to any font you like:
rtb.SelectionFont=new Font("Arial", 24, FontStyle.Bold);
if you want it to resemble the original font(s), you might:
- remember the selection start and length
- apply a new selection, inside the original one (e.g. the first char)
so you can investigate what font that was using
- maybe iterate the previous step for different selection parts
- restore the original selection
- now apply a new font, based on what you discovered
|
|
|
|
|
Thanks Luc,
I was really hoping that something so complex wasn't required!
Kind regards,
John.
|
|
|
|
|
That was clever, I've always admired your logic Luc!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
i need to have standrad toolbar like microsoft aplication have default buttons like save -edit -delete -find -......
and when click button in the toolbar execute it's code on the active form
for example
when i click save button save changes in active form
i need not to but button for save -edit -delete - find in every form
i need help in the soulation
thanks
md_refay
|
|
|
|
|
You need a menustrip. Drop it on a form and insert standard items. You will have to handle all the clicks yourself.
Looking at you last questions I suggest you buy a book about c# and winforms and/or learn searching.
|
|
|
|
|
i need to have general variable that can set or get it;s value from any form in my application it;s save it;s value between forms
md_refay
|
|
|
|
|
You can have a public shared variable and any form will be see it but to exchange information between forms have a look at this: passingvaluesbetweenforms[^]
|
|
|
|
|
public static variables should do the trick.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
i need to call windows calcualtor from my application how?
md_refay
|
|
|
|
|
Have a look at Process class
|
|
|
|
|
Hi,
Here is the code snippet:
System.Diagnostics.Process p = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo sinfo = new System.Diagnostics.ProcessStartInfo();
sinfo.FileName = @"C:\WINDOWS\system32\calc.exe";
p.StartInfo = sinfo;
p.Start();
Thanks,
Gopal.S
|
|
|
|
|
System.Diagnostics.Process.Start(@"CALC.EXE");
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
i try this, great!
roger wong
msn:wenmianbj@hotmail.com
|
|
|
|
|
Hi,
Any idea how to directly show child table when clicking on the bloody parent collapse button in a datagrid control?? Do we always have to see the bloody relationship name link and click on it to open the child?? Can we hide the bloody toolstrip from the top of the child table?? Is there any other way to view datagrid table in more friendly way, say, have more than one child open simultaneously.. Is the bloody datagrid control that bloody??
Thanks for reading my bloody post;)
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Yesterday I had a great experience designing an application in WPF. It's really cool to see how easy it was to create a databound treeview. However, I want to drag nodes within the treeview.
So far I did the following:
- Implement a mousemove eventhandler that initiates the drag operation
- Implement a dragover eventhandler to check if a dragged item can be dropped
- Implement a drop eventhandler that moves the item.
However the last eventhandler proves to be problematic. Although I have the correct data, I can't seem to grab the treeviewitem that th mouse is currently over. Anybody knows how I can get this?
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
|
|
|
|
|
Try searching through articles, I remember running across a good one dealing more or less with your issue just this week but sorry I cant remember the title not the author.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
|
Thanks Willem, I've been through that one as well, it's also good..
I found the one I just told you about. You may wanna take a look at it as well.
Cheers,
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Unfortunatly that one is for Windows Forms, however I did manage to get a bit further with detecting the item that the source item is being dragged on. Now to fix the last bugs, because now it seems as if the MouseMove event is no longer fired if you iniated a drag operation.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
|
|
|
|
|
Good, I think I'll be into WPF or WTF;P soon.. No seriously, I'm interested, it sounds quite sexy
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
As it turned out the solution was moderatly simple.
I had to do the following in the drop eventhandler:
Task t = (Task)e.Data.GetData(typeof(Task));
_currentMousePosition = MouseUtilities.GetMousePosition(taskTree);
HitTestResult result = VisualTreeHelper.HitTest(taskTree, _currentMousePosition);
if (result.VisualHit is FrameworkElement)
{
_targetTask = (result.VisualHit as
FrameworkElement).DataContext as Task;
}
After that it's just removing the task from the original parent and add it to the new parent. Pretty easy
Too bad the mouse handling in WPF sucks, because I had to rely on Josh Smith's MouseUtilities class to get the actual mouse position relative to the treeview. Maybe I will build a dragdropmanager for the treeview similar to the one Josh created. It makes life a lot easier.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
|
|
|
|