Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Help on char or string var
Helo everyone!

I'm making some little app whitch will help me to get things automated,,,im
in the need very often to make some little changes to some files, and
something like this:

dim string1
dim string2
dim temp

temp=string1
string1=sting2
sting2=temp

now, my procedure is taking every file, open it, do some changes and save it
!
but i loos my characters. Im from Croatia (EU) and have some chars like
|Đ_ŽĆČ|...how can i save in unicode file type.

my code is:
==============================

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If Label4.Text = "" Then
MsgBox("izaberi putanju prvo")
Exit Sub
End If

If TextBox1.Text = "" Then
MsgBox("Unesi barem nesto u gornje polje!")
Exit Sub
End If

Dim putanja As String = StatusBar1.Text & "\"
Dim dirinfo As DirectoryInfo
Dim niz As Array
Dim dir As Array
Dim filinf As FileInfo
Dim a As Int16 = 0
Dim tee As String

dirinfo = New DirectoryInfo(putanja)
niz = dirinfo.GetFiles("*." & TextBox3.Text)
dir = dirinfo.GetDirectories()

For Each filinf In niz
temp_string.Text = " "
temp_string.Refresh()
Dim sr As StreamReader = New StreamReader(putanja & filinf.Name)
Label5.Text = filinf.Name
Label5.Refresh()
temp_string.Text = sr.ReadToEnd
sr.Close()
temp_string.SelectAll()
Dim index As Integer = temp_string.Text.IndexOf(TextBox1.Text)
While index >= 0
temp_string.Select(index, TextBox1.TextLength)
temp_string.SelectedText = TextBox2.Text
index = temp_string.Text.IndexOf(TextBox1.Text, index + 1)
a += 1
End While
If a > 1 Then
MsgBox("nadjena je rijec!")
End If
Label9.Text = a
tee = temp_string.Text

'temp_string.SaveFile(putanja & filinf.Name)

Dim sw As StreamWriter = New StreamWriter(putanja & filinf.Name)
sw.Write(tee)
sw.Flush()
sw.Close()

Next
End Sub

==============================

thanks in advance



-k.p.

Report this thread to moderator Post Follow-up to this message
Old Post
gorostas
05-26-05 08:56 PM


Re: Help on char or string var
You'll have to ask this question in a .NET newsgroup...

Here is one, I am sure others will share more.

microsoft.public.dotnet.languages.vb

Good luck!
Saga

"gorostas" <gorostasREMOVE_THIS@hotmail.com> wrote in message
news:E223AC2E-2B21-43DB-905E-7FBFB328F11B@microsoft.com...
> Helo everyone!
>
> I'm making some little app whitch will help me to get things
> automated,,,im
> in the need very often to make some little changes to some files, and
> something like this:
>
> dim string1
> dim string2
> dim temp
>
> temp=string1
> string1=sting2
> sting2=temp
>
> now, my procedure is taking every file, open it, do some changes and
> save it!
> but i loos my characters. Im from Croatia (EU) and have some chars
> like
> |DSZCC|...how can i save in unicode file type.
>
> my code is:
> ==============================
>
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
>        If Label4.Text = "" Then
>            MsgBox("izaberi putanju prvo")
>            Exit Sub
>        End If
>
>        If TextBox1.Text = "" Then
>            MsgBox("Unesi barem nesto u gornje polje!")
>            Exit Sub
>        End If
>
>        Dim putanja As String = StatusBar1.Text & "\"
>        Dim dirinfo As DirectoryInfo
>        Dim niz As Array
>        Dim dir As Array
>        Dim filinf As FileInfo
>        Dim a As Int16 = 0
>        Dim tee As String
>
>        dirinfo = New DirectoryInfo(putanja)
>        niz = dirinfo.GetFiles("*." & TextBox3.Text)
>        dir = dirinfo.GetDirectories()
>
>        For Each filinf In niz
>            temp_string.Text = " "
>            temp_string.Refresh()
>            Dim sr As StreamReader = New StreamReader(putanja &
> filinf.Name)
>            Label5.Text = filinf.Name
>            Label5.Refresh()
>            temp_string.Text = sr.ReadToEnd
>            sr.Close()
>            temp_string.SelectAll()
>            Dim index As Integer =
> temp_string.Text.IndexOf(TextBox1.Text)
>            While index >= 0
>                temp_string.Select(index, TextBox1.TextLength)
>                temp_string.SelectedText = TextBox2.Text
>                index = temp_string.Text.IndexOf(TextBox1.Text, index +
> 1)
>                a += 1
>            End While
>            If a > 1 Then
>                MsgBox("nadjena je rijec!")
>            End If
>            Label9.Text = a
>            tee = temp_string.Text
>
>            'temp_string.SaveFile(putanja & filinf.Name)
>
>            Dim sw As StreamWriter = New StreamWriter(putanja &
> filinf.Name)
>            sw.Write(tee)
>            sw.Flush()
>            sw.Close()
>
>        Next
>    End Sub
>
> ==============================
>
> thanks in advance
>
>
>
> -k.p.



Report this thread to moderator Post Follow-up to this message
Old Post
Saga
05-26-05 08:56 PM


Re: Help on char or string var
Ok, thanks Saga, ill try



| You'll have to ask this question in a .NET newsgroup...
|
| Here is one, I am sure others will share more.
|
| microsoft.public.dotnet.languages.vb
|
| Good luck!
| Saga



Report this thread to moderator Post Follow-up to this message
Old Post
gorostas
05-26-05 08:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Visual Basic archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 10:20 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.