|
Hi all,
I have write a simple code to read a text file containing Chinese and English characters, however, it returns unexpected result.
my codes are as follows:
Dim oFile As System.IO.File
Dim oRStrm As System.IO.StreamReader
Dim line As String
oRStrm = New System.IO.StreamReader(filepath_in, System.Text.Encoding.Unicode)
Do
line = oRStrm.ReadLine
If Not line Is Nothing Then
Me.txtContent.Text = Me.txtContent.Text & vbCrLf
Else
Exit Do
End If
Loop
Please comments.
Many thanks
|
|
|
|
|
So what is the problem - unexpected results, are we supposed to guess what they are. Oh I know telepathic software, been working on that for some time, haven't quite got it right.
Whats the error and what do you expect to see.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
1st of all, Thanks for your reply.
Getting back to the problem, supposingly, my text file contains "一abc中文" only this line of words.
It should return the same words. But now the outcome is "䂤扡ꑣ꒤", you may see some strange characters here. It's really frustrating me.
Thanks again for ur help.
|
|
|
|
|
I would guess, and it really is a guess, that one of your objects does not support unicode under the current initialisation, possibly the textbox. Another idea, do you have the character set installed.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hm...actully, just read returned text by streamreader already found the text is wrong...sigh..., but thanks for your idea.
|
|
|
|
|
You are reading the file as UTF-16. Is it really encoded using that encoding?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hi i've created a few user defined controls in my project which i had seperately added in a folder named User Control Folder. When i tried to add a new User Control in my project through add> user control on clicking User Control Folder i got the error message as:
"No Visual Studio template information found. See the application log in Event Viewer for more details.
To open Event Viewer, click Start, click Control Panel, double-click Administrative Tools, and then double-click Event Viewer."
when i clicked ok then i got a window which has only two options as inherited form & inherited UserControl
when i select inherited User Contol and press OK i get the Error Message as :
"Error HRESULT E_FAIL has been returned from a call to a COM component."
and also no contol added to my project
Please Help...
|
|
|
|
|
Hi All,
I have a question I want to append Value="0" string into a string
as below
Dim str as String
str="<parameters">
str = str + "Value=??????
how should I do it to make it look as below
<parameters value="0" type="Double">
as this. Like I need to use escape character but in VB.Net escape character is " only so pls. give me a sample code snippet how to use it.
Thanks,
Aleem Mohammad
Senior S/W Engineer
NIIT technologies
abdul.aleem@niit-tech.com
|
|
|
|
|
Double them:
Dim LstrSting As String
LstrSting = "Manas Bhardwaj"
LstrSting = LstrSting + "Value=""0"""
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hi,
Thanks for the answer but if I want to add a variable value with it
Like
Dim name as String = "Sample"
Dim LstrSting As StringLstrSting = "Manas Bhardwaj"
LstrSting = LstrSting + "Value=""0"""
LstrSting=LstrSting + """" + name + """"
how? As I need it should look like the below
<value name="Sample" ----it="" should="" look="" like="" mode="hold">
Thanks,
Aleem Mohammad.
NIIT technologies
abdul.aleem@niit-tech.com
|
|
|
|
|
Well, your code would work...but just a suggestion, using String.Format is always nice as it makes your code more readable...
Dim LstrSting As String
Dim name As String = "Indian143"
LstrSting = "Manas Bhardwaj"
LstrSting = String.Format("{0}""{1}""", LstrSting, name)
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
indian143 wrote: how should I do it to make it look as below
I don't see anything below.
Use the "Ignore HTML" option when you are posting markup code.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
moonshaddow wrote: but it say that onlt a int32 can fit
Is there a way by which you can wear a infant's pant.
BTW, this is how the RichTextBox has been built. The only workaround is to look for another control which support int64.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
just a simple no would have of done, your first line(Is there a way...) was Inappropriate and unnecessary.
J.Hardy
|
|
|
|
|
moonshaddow wrote: was Inappropriate and unnecessary
Don't be silly, a sarcastic remark is always appreciated (if not by the wearee). At least he did elaborate why and give you an avenue to find a solution.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
a sarcastic remark is always appreciated, not really1!
J.Hardy
|
|
|
|
|
Ah but you are the wearee!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
i would be ashamed if i was coders like you, it is you poeple who give coders a bad name
J.Hardy
|
|
|
|
|
J
I'm not a coder. I'm a developer, someone who has a wider view than a coder.
moonshaddow wrote: i would be ashamed if i was coders like you, it is you poeple who give coders a bad name
Where on earth did you get the idea that "coders" have a bad name. Possibly if you are talking about the sweat shop "code from specification" person, but a competant developer commands and usually gets a very high level of respect. Even junior developers in the team I run are respected and appreciated, they work hard and are paid to THINK, they are on their 1st or second job and most of them contribute to this site (hopefully they don't know my pseudonym).
None of them would ask a question like your OP, they would do the research before exposing themselves to the ridicule the question deserves. You need to think about the questions you ask.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
you signature really matches you comment
J.Hardy
|
|
|
|
|
another win for the little poeple!
J.Hardy
|
|
|
|
|
Is it possible to sort by two columns in a listview? Can someone send me a link or sample?
I have a list view that has 4 columns;
Class Code, Class Description, Category Code, Category Description.
Right now it sorts the class code ascending but I want it to sort first by class/category code.
All samples I find that use IComparer are only sorting by a single column.
Thanks,
digicd1
|
|
|
|
|
The control does not support it, I suspect you need to sort your data source and then bind to it, sorted. Or write code to shuffle items yourself.
Oh - what if you just sort by your secondary key, then your primary key ? Wouldn't that work ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|