Minimalist 96 Posting Pro

O.K. I just played around with it. In Solution Explorer make sure you have selected Any CPU as target. Then I put, just for testing, this line on top of form1.load:

 Private oskProcess As Process

and just called in form load:

 Process.Start("osk.exe")

which worked fine when running the exe.

Minimalist 96 Posting Pro

Can you find out which line throws the error?

Minimalist 96 Posting Pro

This works fine for me on windows7 64 bit:

Private Sub TextBox1_MouseClick(sender As Object, e As MouseEventArgs) Handles TextBox1.MouseClick
        Process.Start("OSK.EXE")
    End Sub
Minimalist 96 Posting Pro

There is some code for manipulation of the keyboard here:
http://hot-virtual-keyboard.com/development/q1/
I believe it is not possible to place it within a form in vb.net as it is a part of the operating system like notebook. You might be able to use the position to place it over your form.

Minimalist 96 Posting Pro

Just to check your system is o.k. copy OSK.EXE into the command line where it says "search programs and files" and start it from there outside of your program. If it works than there is something in your program preventing it from running. You might be able to run it without directory reference like:
Process.Start("OSK.EXE")

Minimalist 96 Posting Pro

A typically example of trying to use a chunk of 300 lines of code without making an effort of understanding it and expecting others to to modify. I think not!

Minimalist 96 Posting Pro

From your example I see that you want to get rid of the word go or Go. The best way to achieve this would be the string replace method. Just replace go or Go with "". You need to pay attention to: " Go "or "Go "or " go " etc. so you don't replace go within other words.
http://www.dotnetperls.com/replace-vbnet

Minimalist 96 Posting Pro

2.jpg Unicode character U+2640 called the female or venus sign. It will not do you any good in a notepad text file. Remember - this came from a unix program generated text and is probably a control character that is not understood by notepad and consequently the unix control character was mapped to a unicode character. If you want to keep it as is, don't delete the line it is in. You might as well insert a smily.

Minimalist 96 Posting Pro

You are using the name the sheet and not it's index.
Example:
osheet = CType( obook.Worksheets.Sheets(2), Excel.Worksheet)
See if this works, otherwise you need to modify it.

Minimalist 96 Posting Pro

You are welcome.

Minimalist 96 Posting Pro

The code looks at each control in the form and if finds a textbook it executes the code.
So if you only have the 8 textboxes you don't need to address these in paricular, othrewise if you have other textboxes as well you have to address only the ones you want, but if the others would contain also letters besides numbers you are also o.k.
Error checking is always a must.

This code prints the sorted numbers to the debug.window and allows this way a quick check if everything worked as expected.

For i = 0 To numArr.Count - 1
                Debug.Print(numArr(i).ToString)
 Next
Minimalist 96 Posting Pro

In my line 6 I should have checked that there are no spaces in a textbox via the spacebar and it would be better to trim the text as in:

   If Len(Trim(txt.Text)) > 0 Then 'line 6

Otherwise thanks for the vote.

Minimalist 96 Posting Pro

@Shark1
I don't understan your post. From my code you can see that I only add text from the textboxes with length > 0 so there are no blank elements in my list. I also change the type to Integer(well the OP didn't say what type of numbers he wants to sort. O.K. to check the validity of my code just make up 8 textboxes and add elements at form load like this:

TextBox1.Text = "12"
        TextBox2.Text = "1"
        TextBox3.Text = "2"
        TextBox4.Text = ""
        TextBox5.Text = "125"
        TextBox6.Text = "12"
        TextBox7.Text = ""
        TextBox8.Text = "121"

Copy my other code in a button click event and run. The list only contains non empty entries and the sort is done on Intger values.

Minimalist 96 Posting Pro

@Mr.M
Your comment is useless as Sanu also tries to sort text instead of numbers.
@ Sanu
As the OP stated he wants to sort numbers.
These few lines of code will do all this:

Private Sub Sort_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim numArr As New List(Of Integer) 'assuming integers
        'here we add the textbox elements if they are not empty
        For Each txt As Control In Me.Controls
            If txt.GetType Is GetType(TextBox) Then
                If Len(txt.Text) > 0 Then
                    numArr.Add(CInt(txt.Text)) ' assuming integers
                End If
            End If
        Next
        'here we sort these
        numArr.Sort()
        'here we check that all went well
        For i = 0 To numArr.Count - 1
            Debug.Print(numArr(i).ToString)
        Next
    End Sub
Minimalist 96 Posting Pro

Sorry forgot to mention that you might be better off using a list of T or hashtable. Look at this link:
http://www.dotnetperls.com/list-vbnet

Minimalist 96 Posting Pro

You are assigning either text to your array elements or nothing, that means if a textbox1.text="" then this element IntArr(0)="". So your array might look like this: "",3,7,"" etc. For sure if you return these elements there will be "" or 0 in it. So what you can do is remove all the empty array entries with removeat or you dont add these to your array, which means you don't assign the textbox.text directly to the array items but add these to the array. Also I can't see where you change the text to numbers, e.g. you are sorting text?

Minimalist 96 Posting Pro

O.K almost there. To assign the discount you need a variable declared at formlevel - so you can set it in a sub and reuse it in your msgbox.

Public Class Form1
    Dim Perc As String = ""

Then we go to your txtQty_TextChanged sub. Here we need to change the code to:

 Private Sub txtQty_TextChanged(sender As Object, e As EventArgs) Handles txtQty.TextChanged
        Dim num As Integer = 0
        If txtQty.Text <> "" Then
            num = CInt(txtQty.Text)
            Debug.Print(num.ToString)
        End If
        If num < 5 Then
            txtPay.Text = num * Val(txtPrice.Text) & "лв"
            Perc = " 0%"
            Debug.Print("0%  ")
        End If
        If 5 <= num And num <= 9 Then
            txtPay.Text = num * Val(Val(txtPrice.Text) - (Val(txtPrice.Text) * 0.05)) & "лв"
            Perc = " 5%"
            Debug.Print("5%")
        End If
        If 10 <= num And num <= 14 Then
            txtPay.Text = num * Val(Val(txtPrice.Text) - (Val(txtPrice.Text) * 0.1)) & "лв"
            Perc = " 10%"
            Debug.Print("10%")
        End If
        If 14 <= num And num <= 99999 Then
            txtPay.Text = num * Val(Val(txtPrice.Text) - (Val(txtPrice.Text) * 0.15)) & "лв"
            Perc = " 15%"
            Debug.Print("15%  ")
        End If
    End Sub

With the debug.print statements you can check at any time values by printing these to the immidiate plane. So you can check that you get the correct values. We also assign Perc to the valid discount given.
Last we assign perc to a value in the msgbox:

 Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        MsgBox("???: …
Minimalist 96 Posting Pro

With the percentages you need to pay attention because from your first post it wasn't clear what percentages you really want. I think you know where to change these likeL 0.05 = 5%, 0.1 =10%, 0.15=15% and 0.4 = 40%. I just put these according to your first post. For the pecentage display just make add something like & " 15%" to whee you want to displaa it.

Minimalist 96 Posting Pro

That is to confusing for me. You need to show more code and explain what you mean by keyboard.

Minimalist 96 Posting Pro

So what do you want to happen?

Minimalist 96 Posting Pro

Can you be more clear about of what is going wrong? Also what do you mean by "created a keyboard in textbox1"?

Minimalist 96 Posting Pro

O.K. try this then:

Private Sub txtQty_TextChanged(sender As Object, e As EventArgs) Handles txtQty.TextChanged
        If Val(txtQty.Text) < 5 Then
            txtPay.Text = Val(txtQty.Text) * Val(txtPrice.Text) & "лв"
        End If
        If 4 < Val(txtQty.Text) < 10 Then
            txtPay.Text = Val(txtQty.Text) * Val(Val(txtPrice.Text) - (Val(txtPrice.Text) * 0.05)) & "лв"
        End If
        If 9 < Val(txtQty.Text) < 15 Then
            txtPay.Text = Val(txtQty.Text) * Val(Val(txtPrice.Text) - (Val(txtPrice.Text) * 0.1)) & "лв"
        End If
        If 15 < Val(txtQty.Text) < 99999 Then
            txtPay.Text = Val(txtQty.Text) * Val(Val(txtPrice.Text) - (Val(txtPrice.Text) * 0.4)) & "лв"
        End If
    End Sub
Minimalist 96 Posting Pro

Well in line 43 you have already a good start. You can use this to work out the discount. What have you tried?
Your formula is something like:
endprice=Val(txtQty.Text) * (price-(price*0.05)) for the 5%

Minimalist 96 Posting Pro

So you want to display the discounted price, if there is one in
txtPay.Text ?

Minimalist 96 Posting Pro

@ shark
No, she didn't write qty is order number but she wrote "qty is the number of times...."
@ jez9
Since your original questions has been answered by Jim you should close this thread as solved and open a new one with the new problem you are facing.
@ All of us
Since a lot of us are not native Englis speakers please write your questions as clearly as possible and also read questions and answer carefully. Otherwise threads will get endlessly long and confusing. Thanks

Minimalist 96 Posting Pro

O.K. it would be better you mark this thread as solved and start a new thread with the new questions. This way this thread doesn't get to long and makes it easier for some one searching later with keywords. You also may mark up code snippets that helped to solve your problems. Thanks

Minimalist 96 Posting Pro

O.K I changed the code for the validating a bit to:

Private Sub TextBox1_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating
        If TextBox1.Text.Length < 10 Then
            MessageBox.Show("10 ?????")
            e.Cancel = True
        ElseIf TextBox1.Text.Length > 10 Then
            MessageBox.Show("???????? 10 ???????? ?? ?????!")
            e.Cancel = True
        End If
    End Sub

Maybe this will work for you.
And for textbox2 I have gone back to the keypress event:

Private Sub TextBox2_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox2.KeyPress
        If Not ((Asc(e.KeyChar) = 8 OrElse e.KeyChar = " ") OrElse (e.KeyChar >= "A" AndAlso e.KeyChar <= "Z") OrElse (e.KeyChar >= "a" AndAlso e.KeyChar <= "z")) Then
            e.Handled = True
            CType(sender, TextBox).Clear()
            MessageBox.Show("???????? ???!")
        End If
    End Sub

See if this is what you want. Once you got this working as you need we check on the other problems.

Minimalist 96 Posting Pro

Using focused.item doesn't mean it is also selected.
"lvorders.FocusedItem.SubItems(2).Text"
instead use selecteditems or selectedindicies as cgeier pointed out to you before.

Minimalist 96 Posting Pro

With your text.length in textbox1 I don'understand what you want to do. Anyway, for the purpose of validation you can use:

 Private Sub TextBox1_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating
        If TextBox1.Text.Length >= 9 Then
            MessageBox.Show("10 ?????")
        Else
            MessageBox.Show("???????? 10 ???????? ?? ?????!")
        End If
        e.Cancel = True
    End Sub

I use your origanal code but put it in TextBox1_Validating. This way you don't pop each time the msg.

Minimalist 96 Posting Pro

Also change your textbox2 eventhandler to:

Private Sub TextBox2_KeyUp(sender As Object, e As KeyEventArgs) Handles TextBox2.KeyUp
        If Not (e.KeyValue > 64 Or e.KeyValue < 91 Or e.KeyValue > 96 Or e.KeyValue < 123 Or e.KeyValue = Keys.Space) Then
            MessageBox.Show("???????? ???!")
        End If
    End Sub
Minimalist 96 Posting Pro

Well, I suppose people don't like to download whole projects for security reasons. Also for the benefit of the thread it is better to display the code so every one interested can help out. O.K. so I downloaded your code. You are still using the keypress event. This handles only characters if there is one -so don't catch the Return or other keys that are not characters. That is why I suggested to use the keyup event in my previous post to handle also keys that don't have a character representation. You also should put Option Strict On which wouldn't allow you to do this:

 txtPay.Text = Val(txtQty.Text) * Val(txtPrice.Text) & "лв"

here you mix up string and numbers and hope the compiler will sort it out.
On line 39 you dim pay outside of a sub.
And for your textbox2 its the same as for your textbox1 - don't use the keypress event.

Minimalist 96 Posting Pro

Maybe put conn.Open() before executing:

Dim cmd As New OleDbCommand( _
            "SELECT * FROM Subjects WHERE [StudentID]= '" & StudentID.Text & "'", conn)
Minimalist 96 Posting Pro

O.K. lets deal with one issue at a time. First use the keyup ebent to check for invalid entry and also for the enter key and the back_key to allow editing if a wrong number has been enterd.

 Private Sub TextBox1_KeyUp(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyUp
        If Not ((e.KeyValue >= 48 AndAlso e.KeyValue <= 57) OrElse e.KeyCode = Keys.Enter OrElse e.KeyCode = Keys.Back) Then
            MessageBox.Show("That's not numeric!")
            TextBox1.Text = TextBox1.Text.Substring(0, TextBox1.Text.Length - 1)
            TextBox1.Select(TextBox1.Text.Length + 1, 1)
        End If
    End Sub

If a wrong input was made wedisplay the Msg, remove the wrong character and move the cursoe back to the end of the string for new input.

Minimalist 96 Posting Pro

You need to insert a me.refresh as so:

 Me.BackColor = Color.White
 me.refresh
        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
        PrintForm1.Print()
        Me.BackColor = Color.Black
        me.refresh
Minimalist 96 Posting Pro

Hi Don,
I think the only thing you need to do is changing:
My.Computer.FileSystem.WriteAllText(RestranName2, goodLine, True) to:
My.Computer.FileSystem.WriteAllText(RestranName2, goodLine & vbCrLf , True)
adding a carrige return and linefeed

Minimalist 96 Posting Pro

The framework itself doesn't support renaming of projects. However, there are solutions. First make a backup of your project. Then use the first link to manually change items. The second link is to a program that may work for you.
http://msdn.microsoft.com/en-us/library/3e92t91t%28v=vs.90%29.aspx
http://www.codeproject.com/Articles/1198/Visual-Studio-Project-Renamer

@imti321
Don't post not working links.

Minimalist 96 Posting Pro

Go to Solution Explorer--- Double click on MyProject----Goto Application and where it says Icon ---- select your own Icon.

Minimalist 96 Posting Pro

It is not very clear what you are asking. In your definition 2 numbers are equal if they contain the same digits. So |123| = |312| etc. But what about |123| =? |11332222|? If they contain the same numbers of digits then you can pu them into arrays and sort them: 123 = 123 and then just see if str1=str2. Your approach also leads to a result but you need to compare each character of the second string(Loop):

If n1.Contains("1") Then
                'Do Something
                End if
Minimalist 96 Posting Pro

Very good. Please mark the thread as solved. Thanks.

Minimalist 96 Posting Pro
Minimalist 96 Posting Pro

O.K try to run this script in a file's directory:

set fso = CreateObject("Scripting.FileSystemObject")
dim CurrentDirectory, Fil,Fso,text,stringname,str1, fcount
dim stringfolder
    CurrentDirectory = fso.GetAbsolutePathName(".")
    stringfolder = currentDirectory
    set FLD = FSO.GetFolder(stringfolder)
    fcount=0
        For Each Fil In FLD.Files
if Fil.Name <> "Convert.vbs"  then
        fcount=fcount+1
         Filename = stringfolder & "\" & Fil.Name
            text = fso.OpenTextFile(Filename).ReadAll
text = Replace(text,vblf,vbcrlf)
text = Replace(text,vbcr & vbcr, vbcr)
text = Replace(text,"""","")
newfilename = "C" & fil.name 
 set tso = fso.OpenTextFile(newfilename, 2, True)
 tso.write text
end if
tso.Close
   Next
msgbox "Number of Files concerted  " & fcount

Name the script exactly as Convert.vbs and run it once. It should create a copy of the file with a C in front.

Minimalist 96 Posting Pro

You have 150 folders with one file in it? Why? And yes, the script is meant to run within the folder the files you like to vonvert are located. Now, just to check the script is running insert a newline under line 5 and we try to bring up a msgbox with the folder name. So type into the newline
msgbox stringfolder
Now if the msgbox pops up and nothing else happens you need to show what the complete filename is we are trying to process.

Minimalist 96 Posting Pro

Nooo! Don't add any code to it. It is a script file. Does the icon of Notepad looks like the one I added. Add a new line under line 17 and insert msgbox newfilename
so we can see if it runs through

Minimalist 96 Posting Pro

O.K. here is a vb script file that will do what you want. Again, you need to copy the code into Notepad and save the Notepad file as convert.vbs . You also need to set the Encoding to ANSI in the Notapad "Save As" Window. The vbs file needs to be run within the directory where your files to be converted are located. You run the vbs file by double clicking on it. It will convert all text files.
I have used some of Jim's code. The new file names will start with a C at the beginning of the old file name.

set fso = CreateObject("Scripting.FileSystemObject")
dim CurrentDirectory, Fil,Fso,text,stringname,str1, fcount
dim stringfolder
    CurrentDirectory = fso.GetAbsolutePathName(".")
    stringfolder = currentDirectory
    set FLD = FSO.GetFolder(stringfolder)
    fcount=0
        For Each Fil In FLD.Files
        fcount=fcount+1
         if strcomp(right(Fil.Name,4),".txt",1)=0 then
         Filename = stringfolder & "\" & Fil.Name
              str1=Right(Fil.Name,4)
text = fso.OpenTextFile(Filename).ReadAll
    text = Replace(text,vblf,vbcrlf)
    text = Replace(text,vbcr & vbcr, vbcr)
    text = Replace(text,"""","")
newfilename = "C" & fil.name &  str1 
 set tso = fso.OpenTextFile(newfilename, 2, True)
 tso.write text
tso.Close
        end if
Next

In line 17 the new file name is set.

Minimalist 96 Posting Pro

Check out the proper usage of Streamreader here:
http://www.dotnetperls.com/streamreader-vbnet

Minimalist 96 Posting Pro

I just copied the path from above assuming thats what it is. Otherwise:
Dim dirs As String() = Directory.GetFiles("C:\Restran Conversion\IPSDATA\PM00213A\" & ".")

Minimalist 96 Posting Pro
 Dim dirs As String() = Directory.GetFiles("C:\Restran Conversion\IPSDATA\PM00213A\", "*.*")
 Dim dir As String
        For Each dir In dirs
            Debug.Print(dir)
        Next
Minimalist 96 Posting Pro

O.K I can see it now. Try Jim's suggestion and if it doesn't work I shall post some code to strip the quotes.

Minimalist 96 Posting Pro

Sorry, in the 19kb file I cant see any quotes and the 213 file has only adate in it.

Minimalist 96 Posting Pro

Have look at this link:
http://stackoverflow.com/questions/11501531/saving-a-excel-file-into-txt-format-without-quotes
If it doesn't work I shall post some code to strip the the text.