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

Show us the code you have got sofar

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

Maybe it would be better to start off by setting up the datagridview1 correctly at the form load event and after using a button to do whatever you want to do. Also you need to add rows to the datagridview1:

 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim row As String = ""
        For i As Integer = 0 To 6
            DataGridView1.Rows.Add(row)
        Next
        For i As Integer = 1 To 7
            DataGridView1.Rows(i - 1).Cells(0).Value = i
        Next
End Sub
Minimalist 96 Posting Pro

You can only resize the last dimension of a multidimentional array.
http://stackoverflow.com/questions/2651682/resizing-a-two-dimensional-array

Minimalist 96 Posting Pro

The easiest way to do this would be the string.split method. Even if the name contains two or more spaces the op can decide which ones to use for initials. Good example is here:
http://www.dotnetperls.com/split-vbnet
and it uses also a For-Next loop

Minimalist 96 Posting Pro

I had the same issue a while back. My problem was fixed by changing some of the MyProject settings. Double click on MyProject---> and click on the tab Signing, I unchecked all in there. After everything was working o.k. If this doesn't help see the following link:
http://www.codeproject.com/Questions/629067/How-to-add-a-manifest-file-in-my-project

Minimalist 96 Posting Pro
Minimalist 96 Posting Pro

In your masked textbox set your input mask in the properties window to: >L
This allows the input of one character changed to upper case.
Then put the following codes:

 Private Sub MaskedTextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles MaskedTextBox1.KeyDown
        If e.KeyCode = Keys.P Or e.KeyCode = Keys.N Or e.KeyCode = Keys.R Then
            MsgBox("Good imput, proceed with code")
        End If
    End Sub

and also:

Private Sub MaskedTextBox1_KeyUp(sender As Object, e As KeyEventArgs) Handles MaskedTextBox1.KeyUp
        If e.KeyCode <> Keys.P Or e.KeyCode <> Keys.N Or e.KeyCode <> Keys.R Then
            MaskedTextBox1.Text = ""
            MaskedTextBox1.Refresh()
        End If
    End Sub

The code in the key up event will reset the masked textbox in case of wrong input.

Minimalist 96 Posting Pro

Which event do you use your code in?

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

Well, in your settings form button1 you do declare a new form. If you want to just get back to form1 just do: form1.show(). You also don't need to close form1 to show form2. You just can hide form1 using: me.hide(). If all this doesn't work you need to call your function again.

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.

Minimalist 96 Posting Pro

Glad that it worked. Please mark the thread as solved. Thankyou.

Minimalist 96 Posting Pro

If you must use a goto statement you have to mark the line like so:
30:
GoTo 30

Minimalist 96 Posting Pro

O.K. we need to be clear about file naming in unix. Unix files don't have an extension. You can have something like: 123456.pdf to indicate a pdf file but the .pdf is not an extension like in windows but the filename. Under DOS you had the restrictions of Filename max. 8 characters and a three character extension like: 12345678.txt.
Under windows a file name, including path can now have 260 characters. So to get back to your problem:
The filename you are working with is: 20141210.104056
So a

  filePath = "O:\IPSDATA\PMS03361A\" & 20141210.104056 & ".*"

will not work since you want to search characters in the filename. So to use wild cards it has to be somethig like:
20141210.###### as this is the wild card for numbers. See also:
http://www.databison.com/string-comparison-function-in-vba/
http://answers.google.com/answers/threadview/id/191785.html

Minimalist 96 Posting Pro

Well, you need the full path to the folder but then yes, this should work like:
" 20141210.* " which is working on windows. For unix have a look at this:
http://www.acnenomor.com/1652273p1/how-to-get-the-file-name-from-the-path
O.K having written this the problem may be with length of the file extension, in windows it is only three characters.You might need to write a small conversion program to get somethig like:
20141210_104056.txt which then can be read by windows. Just a thought.

Minimalist 96 Posting Pro

@ shark 1
maybe you can explain to the forum why you vote me down if you made the mistake. I voted you down because you replicated the mistake in the first place.

Minimalist 96 Posting Pro

An array starts counting at 0. So your llop shoild be:

For loop = 0 to 2
    If Array(Loop).text = Data_In_Database then
    'Do something
next

whic gives you the indexes 0, 1,2, = 3 items

Minimalist 96 Posting Pro
Minimalist 96 Posting Pro

date1 = Date.Today should be date1 = CStr(Date.Today) because you declared date1 as string.

Minimalist 96 Posting Pro

You don't need any coding to display a splash screen. In solution explorer click on My Project and in the Application windown, down the bottom you can select any of your form as splash screen. This will pop up before your first form loads.

Minimalist 96 Posting Pro

This how you get the screen resolution:

 Dim intX As Integer = Screen.PrimaryScreen.Bounds.Width
 Dim intY As Integer = Screen.PrimaryScreen.Bounds.Height
 Label1.Text = (intX & " × " & intY)

and here isa little program that lets you play around with different screen sizes:

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        ScreenResolution()
        Me.Text = "Screen Size Display"
        Label5.Text = "ChildForm width=" & "  " & Form2.Width
        Label6.Text = "ChildForm width=" & "  " & Form2.Height
        Label7.Text = "ChildForm Top" & "  " & Form2.Top - Me.Top
        Label8.Text = "Childform Left" & "  " & Form2.Left - Me.Left
        TextBox1.Text = "600"
        TextBox2.Text = "800"
        GetVersionFromEnvironment()
    End Sub
    Public Sub ScreenResolution()
        Dim intX As Integer = Screen.PrimaryScreen.Bounds.Width
        Dim intY As Integer = Screen.PrimaryScreen.Bounds.Height
        Me.Width = intX
        Me.Height = intY
        Label1.Text = (intX & " × " & intY)
        Form2.Show()
    End Sub
    Private Sub Go_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Me.WindowState = FormWindowState.Normal
        Dim scWidth As Long
        Dim scHeight As Long
        scWidth = CInt(TextBox1.Text)
        scHeight = CInt(TextBox2.Text)
        'Make sure the size is acceaptable
        If scHeight >= 200 And scWidth >= 200 Then
            Me.Width = CInt(scWidth)
            Me.Height = CInt(scHeight)
            Me.CenterToScreen()
            Form2.Top = Me.Top + 20
            Form2.Left = Me.Left + 20
        Else
            MsgBox("Size Not Acceptable")
        End If
    End Sub
    Private Sub Working_Click(sender As Object, e As EventArgs) Handles Button2.Click
        ' Retrieve the working rectangle from the Screen class
        ' using the PrimaryScreen and the WorkingArea properties. 
        Dim workingRectangle As System.Drawing.Rectangle = Screen.PrimaryScreen.WorkingArea
        ' Set the …
Minimalist 96 Posting Pro
Minimalist 96 Posting Pro

Field names with spaces in them will create problems as in "Projcet Name"
better to use Projcet_Name or brackets "[Projcet Name]"

Minimalist 96 Posting Pro

There is no Show statement. You need to use the Select statement.

Minimalist 96 Posting Pro

You might want to check this out:
http://www.dotnetperls.com/if-vbnet

Minimalist 96 Posting Pro

It is .Execute with a t not .Execule

Minimalist 96 Posting Pro

Maybe check the spelling first?

sqlCMD.ExecuteScalar()