Minimalist 96 Posting Pro

Well, you can't just copy my code into your program before thinking about or trying it on its own. If you copy the code I give you now into a small testing program as it is it will work. You need to modify to your needs so.

Private Sub Form_Load()
Dim str As String
Dim ar(5) As String
ar(0) = "apple"
ar(1) = "banana"
ar(2) = "plum"
ar(3) = "apple"
ar(4) = "plum"

Debug.Print (Combo1.ListCount)
For i = 0 To 4
    str = ar(i)
    For j = 0 To Combo1.ListCount - 1
        If str = CStr(Combo1.List(j)) Then
        MsgBox ("Double Entries not allowed")
        Exit For
        End If
    Next
    If str <> CStr(Combo1.List(j)) Then
        Combo1.AddItem str
    End If
Next
End Sub
Minimalist 96 Posting Pro

1) I would check that there is nothing in any of the 3 keypress events
2) I would move the calculations of the row somewher else
3) If nothing changes I would create a new datagrid on the form, input some values, use the double click and if this works O.K I would check if some of the properties are different to the datagrid you use.

Minimalist 96 Posting Pro

If you don't want anything happen on the key enter just don't use it.

 Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress
        Dim NotAllowed As String = "~`@%^&+={[}]()!:,;'><?/|\-.#+()_$*"
        If e.KeyChar <> ControlChars.Back = True Then
            If NotAllowed.IndexOf(e.KeyChar) = -1 = False Then
                e.Handled = True
            End If
        End If
    End Sub
Minimalist 96 Posting Pro

O.K I just go back to the original post as this seemed to work and change it to:

ACRS.Open "SELECT * FROM Salary1", CN, adOpenStatic, adLockOptimistic
dim j as integer 'need to count items in combo
Sfm = ACRS!Month
Do Until ACRS.EOF
  For j = 0 To CmbSfm.ListCount - 1 'each item check against all items in the combo
   If Sfm = CStr(CmbSfm.List(j)) Then
      MsgBox ("Double Entries not allowed")
     else
     CmbSfm.AddItem ACRS!Month
    End If
ACRS.MoveNext
Loop
Minimalist 96 Posting Pro

O.K I can't replicdate this behaviour. What you can do is insert this code and double click in different rows, different cells and see if the values in the cells are return to the debug window. If yes, there is a bug in your code or you need to use another event to calculate your rows. Using debugging your code and go with the mouse over yourvariables will also display the values.

Private Sub DataGridView1_CellMouseDoubleClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseDoubleClick
        Debug.Print(DataGridView1.CurrentCell.Value.ToString)
    End Sub
Minimalist 96 Posting Pro

So what happen if you enter a value and move with the arrow keys?

Minimalist 96 Posting Pro

Check the keypress event of the datagrid.

Minimalist 96 Posting Pro

The error means that you haven't instanciated your workbook. The folowing is I think the way to do it:

'Instantiate a Workbook object.
'Load a template file.
Dim workbook As Workbook = New Workbook("d:\test\MyBook.xls")

'Get the first worksheet in the book.
Dim sheet As Worksheet = workbook.Worksheets(0)

'Insert 10 rows at row index 2 (insertion starts at 3rd row)
sheet.Cells.InsertRows(2, 10)

'Delete 5 rows now. (8th row - 12th row)
sheet.Cells.DeleteRows(7, 5)

'Save the excel file.
workbook.Save("d:\test\out_MyBook.xls")
Minimalist 96 Posting Pro

Please mark it solved. Thanks

Minimalist 96 Posting Pro

Well, you need to adopt the code to what you need. Ishowed you haw to prevent double entries. Since I used only one word, the first time it is added to the combo, after I exit the sub in line 9. You need to put your code there to handle it - means you can't exit the sub.

Minimalist 96 Posting Pro

Well, if they wouldn't put in new features why would they upgrade from vers.1 to vers. 4.5. You find everything here:
http://msdn.microsoft.com/en-us/library/ms171868(v=vs.110).aspx

Minimalist 96 Posting Pro

The higher the version number the more features are built into the framework. The problem is that not every one is upgrading to the highest version of the framework. If you compile to lower version you might lose features you are using in your program. Better is to check before install which version is installed and asked user to install latest version as it is free asnyway.

Minimalist 96 Posting Pro

o.K. thought it would work but its vb.net. The following code works, I just tried it. You need to adapt so.

Private Sub Form_Load()
Dim str As String
For i = 0 To 2
str = "Hello"
Debug.Print (Combo1.ListCount)
For j = 0 To Combo1.ListCount - 1
If str = CStr(Combo1.List(j)) Then
MsgBox ("Double Entries not allowed")
Exit Sub
End If
Next
Combo1.AddItem str
Next
End Sub
Minimalist 96 Posting Pro

Just prevent adding the string to the combobox by checking if it is already in the string collection of the combobox like (don't know if it works):

 If ComboBox1.Items.IndexOf(str) = -1 Then
                ComboBox1.Items.Add(str)
            End If
Minimalist 96 Posting Pro
Public Class Form1
    Dim counter As Integer = 1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        test() 'this is calling the sub named test
    End Sub
    Private Sub test()
        Dim myMessage As String
        Dim Prompt As String = "Input Password"
        Dim title As String = "Inputbox Test"
        Dim defaultText As String = ""
        Dim userpassw As String = "Me"
        myMessage = InputBox(Prompt, title, defaultText)
        If myMessage = "Me" Then
            MessageBox.Show("Password Correct")
        Else
            MessageBox.Show("Wrong Password or Cancel pressed")
            counter = counter + 1
            If counter > 2 Then
                MsgBox("Entry Failed, Good bye")
                End
            End If
            test()
        End If

    End Sub

End Class

You realy should google for the topics you are working with. The above code will do what you are supposed to be doing, try to understand it. Don't forget to close the thread and give credit.

Minimalist 96 Posting Pro

You can't use checks to count the clicks. This could be anything. You need to setup a proper counter tha tincreases each time th bvutton is clicked. Use the button.click eventhandler for this.

Minimalist 96 Posting Pro

You are not showing enough code. Where do you count the clicks and under which condition?

Minimalist 96 Posting Pro

ElseIf checks < 39 Then
This doesn't give you the range 20 -38 but th range 0-38

Minimalist 96 Posting Pro

From the line 3 I can see that you didn't read up on inputbox - google it. Here is a link:
http://msdn.microsoft.com/en-us/library/6z0ak68w(v=vs.90).aspx
Do you know about functions, subroutines and about the scopes of variables -I am asking because I don't understand what you want to achieve in line 1.

Minimalist 96 Posting Pro
'You better read up on the inputbox methods.
'Declare all the values and variables
Dim message as string="Enter the password"
Dim title as string = "InputBox Demo"
Dim defaultValue As String = "Me"
' this code set up your inputbox
' You are supposed to use a loop
'The loop is meant to count to 3 on three different entries
'You need to declare an Integer outside the loop and increase it inside the loop
Dim intCount as Integer=0

See if you can work it out from here

Minimalist 96 Posting Pro

They don't have to be in the same position. Look at this example:
http://msdn.microsoft.com/de-de/library/bb460136(v=vs.90).aspx

Minimalist 96 Posting Pro

Intersection returns only the elements that are contained in both sets. It doesn' rtell you how many or at which positions they are.

Minimalist 96 Posting Pro

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\bin\Debug\bookshop.mdb" shoulds be like this:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\bookshop.mdb"

Minimalist 96 Posting Pro
Minimalist 96 Posting Pro

In the documentation for source it says:
Data Source = |DataDirectory|\Mydb.mdb
so if I look at your connection string you still have directory references in the path which is not allowed.Click Here

Minimalist 96 Posting Pro

It looks to me that in line 9 you want to connect if the passwords are wrong? Check your if--then--else statement

Minimalist 96 Posting Pro

O.K- create a command button
You need the location and the filename of the file you want to copy. You need a location where you want it copy to and you need to give a filename.

Private Sub Command1_Click()
FileCopy "C:\1.txt", "C:\Folder1\2.txt"
End Sub

here you can see that c:\ is the source directory
1.txt is the filename that get copied to c:\ directory into folder Folder1 as file 2.text

Minimalist 96 Posting Pro

Dim SourceFile, DestinationFile As String
SourceFile = "SRCFILE" ' Define source file name.
DestinationFile = "DESTFILE" ' Define target file name.
FileCopy(SourceFile, DestinationFile) ' Copy source to target.

Also show us the code you are using

Minimalist 96 Posting Pro

FileSystemObject.CopyFile "c:\mydocuments\letters\ *.doc", "c:\tempfolder\" Click Here

Minimalist 96 Posting Pro

O.K. here we go for vb6

Private Sub Form_Load()
Text1 = ""
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
  If Not IsNumeric(Text1.Text & Chr(KeyAscii)) And Not KeyAscii = 8 Then
  KeyAscii = 0
  MsgBox ("Not a Number")
  End If
End Sub
Minimalist 96 Posting Pro
 Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Dim str As String = Trim(TextBox1.Text)
        If Not Regex.Match(str, "^[0-9]*$", RegexOptions.IgnoreCase).Success Then
            MsgBox("Please enter Numbers text only.")
        Else
            MsgBox("O.K")
        End If
    End Sub

Sorry this was forvb.net

Minimalist 96 Posting Pro

This will probably work:

Dim strFile, strData As String
Dim ln As Integer
Dim Reader As New System.IO.StreamReader(strFile)

    Do
      strData = Reader.ReadLine()
        ln = strData.Length
           If Mid(strData, 1, 1) = "A" And Mid(strData, ln, ln) = "0" Then
             strData = Mid(strData, 1, ln - 1) & " Replace with this"
             RichTextBox1.Text = RichTextBox1.Text & vbNewLine & strData
           End If

    Loop Until strData Is Nothing
AnooooPower commented: untested but thanks i went with oussama's :D +0
Minimalist 96 Posting Pro

I think the Dim statements in the module don't work like this. You need to dim the databse stuff in the event where you are using them. Also put your error msg into google and you will most likely find some explanation.

Minimalist 96 Posting Pro
Minimalist 96 Posting Pro

O.K. here a re twopictures, one in design mode the other when the application is running. There 2 pictureboxes red andblue and one oval shape yellow. The picture can be moved at run time only when grabbing the red part, that's where I put some code in.

Public Class Form1
    Dim AppLoc, CurLoc As New Point(0, 0)
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
    Private Sub Synchro()
        AppLoc = Me.Location
        CurLoc = Cursor.Position
    End Sub
    Private Sub PictureBox1_MouseDown(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseDown
        Timer1.Enabled = True
        Timer1.Start()
        Synchro()
    End Sub
    Private Sub PictureBox1_MouseUp(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseUp
        Timer1.Stop()
        Synchro()
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Me.Location = AppLoc - CurLoc + Cursor.Position
        Synchro()
    End Sub
End Class
Minimalist 96 Posting Pro

Following your posts I guess you want to have a keylogger that does something when a keycombination is pressed. I would like to hate using a worprocessor and a keycombination and something unexpectedly pops up. This is just a guess on your other posts regarding catching keypress events, installing exe files without a user noticing etc. I hope your program never lands on my computer!

Minimalist 96 Posting Pro

set the borderstyle of your form to none and play around with the opacity

Minimalist 96 Posting Pro

Well, in this you can analyze the installation scripts and find the differences.

Minimalist 96 Posting Pro

Which program are you using to make the setup file?
Also make sure you are not trying to load a file during startup, referencing a file from form load that doesn't exist yet.

Minimalist 96 Posting Pro

Also check that both machines are running the same framwork version.

Minimalist 96 Posting Pro

Even so it is a very simple method to print a form it takes some code to get it right.The reason is the DPI of your monitor and the scale of the paper you are using. Here is a link that will show you hoe to do it:
http://support.microsoft.com/kb/230502/en-us

Minimalist 96 Posting Pro

This will also work:
Dim byDay As Integer = CInt(Trim(txtByday.Text))
but read the article on conversion
http://www.owenpellegrin.com/articles/vb-net/converting-strings-to-numbers/

Pickletronic commented: nice, thanks +0
Minimalist 96 Posting Pro

Maybe use this:

        byHour = CInt(Val(Trim(txtByhour.Text)))
        byDay = CInt(Val(Trim(txtByday.Text)))
Pickletronic commented: It works +0
Minimalist 96 Posting Pro

Sorry, my first reply was more for vb6. Thsi should work in vb.net

For Each frm As Form in Me.MdiChildren
  MessageBox.Show(frm.Name)
Next
Minimalist 96 Posting Pro

O.K. this is the code to check for open child forms and to do something when there are open forms

Dim F As Form
For Each F In Forms
    If F.MDIChild Then
        ' It's a loaded MDIChild form
    End If
Next F
Minimalist 96 Posting Pro

There a few things you can check in vb6 code. Do a serch on google:
check hard disk with vb6
and check this one out:
http://msdn.microsoft.com/en-us/library/vstudio/xw6hsa4x(v=vs.100).aspx
Do a search of search on any hardware check vou want to perform on google

Minimalist 96 Posting Pro

You can close a child form by using:

 Me.ActiveMdiChild().Close()
Minimalist 96 Posting Pro

So tell me what was wrong

Minimalist 96 Posting Pro

Switch all the sorting in your listboxes off. Line 8 will not work like this. It is like I showed you or you have to use:
If Not Len(Trim(entry)) = 0 Then LstData3.AddItem temp

Minimalist 96 Posting Pro

can you open your database with ms access and make sure you got the data in there you want?