Minimalist 96 Posting Pro

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

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
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

You need to take "Dim intSum As Integer = 0" out of the button click event, otherwise you always set it back to 0.

Minimalist 96 Posting Pro

@Mr.M
here is the output from your code. Also I don't know why you would insist on a mistake being correct? Have you tried to run it? I only feel sorry for the OP as her question got side tracked.

Minimalist 96 Posting Pro

@xuexue: If the loop only executes one time just see how often it executes if you put: For k = 0 To 4. If this works then there is something wrong with recno.Length.

@Mr.M
1) For k = 0 to recno.Tostring how is this supposed to work?

Minimalist 96 Posting Pro

O.K. You need to use a monospaced font which assigns each letter, number the same space, so an i would take up the same space as a w. Than you use the Rset function, where the number indecates how much you move your items to the right- depends on the width of the listbox. Here I post a few lines of code that demonstrates the use.

Private Sub Form_Load()
    List1.AddItem ("Hello")
    Dim strItem As String * 20
    RSet strItem = "Testing"
    List1.AddItem (strItem)
    Dim strItem1 As String * 10
    RSet strItem1 = "Testing"
    List1.AddItem (strItem1)
End Sub
Minimalist 96 Posting Pro

Well that would take too long. Look at the imports. Look what you need to put into the eventhandlers and what the events are.Example: Detect on the label that the mouse has entered the region occupied by the label and is ready to drop and so on. You can also google each part of the events and will find out trhat also put it all together by googling. Good luck and don't forget to mark it as solved. Thanks

Minimalist 96 Posting Pro

O.K. You got the addhandler and an event. There is more to it. I have whipped up some minimal code you can start a new project,copy it in, put a button on the form, option strict = off - otherise you will get late binding errors, otherwise the code will work (VB.net express 13)

Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Text
Public Class Form1
    Dim lbl As Label
    Dim flag As Integer = 0
    Dim i As Integer = 50
    Dim dragging As Boolean
    Dim beginX, beginY As Integer
    Dim counter As Integer = 1
    Private ptX, ptY As Integer
    Private drag As Boolean
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


        Dim lbl As New Label

        lbl.Name = "Label" & counter
        lbl.Text = lbl.Name
        lbl.Size = New Size(80, 20)

        lbl.Location = New Point(80, counter * 22)


        AddHandler lbl.Click, AddressOf labMouseClick
        AddHandler lbl.DragEnter, AddressOf labDragEnter
        AddHandler lbl.MouseDown, AddressOf labMouseDown
        AddHandler lbl.DragDrop, AddressOf labDragDrop
        AddHandler lbl.MouseUp, AddressOf labMouseUp
        AddHandler lbl.MouseMove, AddressOf labMouseMove
        Me.Controls.Add(lbl)

        counter += 1
    End Sub
    Private Sub labMouseMove(lbl As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        If drag Then
            lbl.Location = New Point(lbl.Location.X + e.X - ptX, lbl.Location.Y + e.Y - ptY)
            Me.Refresh()
        End If
    End Sub
    Private Sub labDragDrop(sender As Object, e As DragEventArgs)
        e.Effect = DragDropEffects.Move
        Static mousePosX As Single, mousePosY As Single
        lbl.Left = lbl.Left + (e.X - mousePosX)
        lbl.Top = lbl.Top + (e.Y - mousePosY)
    End Sub
    Private Sub labMouseUp(ByVal …
oussama_1 commented: exactly +3
Minimalist 96 Posting Pro

Static x As Integer = 100 or whatever

Minimalist 96 Posting Pro

O.K., using the examples from vb.net it is very easy to format columns, but you need to set the font of the combobox to a mono spaced font. I used Courier New. This is all the code you need:

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim str1 As String = "WWWWWWWWWWWWWWW"
        Dim str2 As String = "Window"
        Dim str3 As String = "OnceAndTwice"
        Dim str4 As String = "Hello"
        Dim str5 As String = "one"
        Dim str6 As String = "Onehundredthousand"
        Dim format As String = "{0,-20} {1,-20} {2,-20}"
        Dim line1 As String = String.Format(format, str1, str2, str3)
        Dim line2 As String = String.Format(format, str5, str6, str2)
        Dim line3 As String = String.Format(format, str3, str5, str1)

        ComboBox1.Items.Add(line1)
        ComboBox1.Items.Add(line2)
        ComboBox1.Items.Add(line3)
    End Sub
End Class

andtheresult looks like on the jpeg.

Minimalist 96 Posting Pro

If your code worked well in vb6 than it means you would have used a mono spaced font, otherwise you would not have been able to line colums as you would like? A mono spaced font gives the same space to every charcter, that means a "W" takes as much space as an "I". In not mono spaced fonts these charcters take up different space and you won't be able to line up the text exactly. Check out the vbTab function: Dim text As String = "abc".Insert(1, vbTab) or check out the more modern way here:
http://msmvps.com/blogs/deborahk/archive/2009/07/21/formatting-text-files.aspx
http://www.dotnetperls.com/string-format-vbnet
If this doen't help I will write a small project and check it out.

Minimalist 96 Posting Pro

Position 25 is either the last letter of the first string or an empty space. Starting with the next string at position 25 gives you either the last letter of the first string or string2 starts with an empty space. So before you work out the length of your strings use Trim(text1) and Trim(text2) to get rid of empty spaces or start text2 t position 26.

Minimalist 96 Posting Pro

First you should clear your combo:
CmbBank.Items.clear
Than you build your string:

str = ((DS.Tables("Deposit").Rows(Iint).Item("Bank")) & " " & DS.Tables("Deposit").Rows(Iint).Item("Acno"))

than you add this to your combo:

CmbBank.Items.Add(str)

Also I would think about to use the split string method instead of using Left() and Mid() functions. To the length of your strings - 25, 5 I can't say anything because I don't know the text that is in there. Left(text,25) returns the first 25 characters of the text and Mid(text,25,17) is wrong.

Minimalist 96 Posting Pro

Obviously you just can't post my code into ypur program. You need to modify it so it does suit your databse. O.K. I give it shot. If it works it will only return one column which shoiuld be printed in zhe direct window with the debug.print command. This is a great help to debug and to see from where your progam goes wrong. Alos remember the .item(0).item(1).item(2) etc.

Dim CN As New OleDb.OleDbConnection
 Dim DBProvider As String
 Dim DBSource As String
 Dim DS As New DataSet
 Dim DA As OleDb.OleDbDataAdapter
 Dim SQL As String
 DBProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
 DBSource = "Data Source=C:\Users\bennet\Documents\Visual Studio 2012\Projects\MavDeposit\MavDeposit\Deposit.mdb"
 CN.ConnectionString = DBProvider & DBSource
 CN.Open()
 SQL = "SELECT Bank,Acno from Receipts"
 DA = New OleDb.OleDbDataAdapter(SQL, CN)
 DA.Fill(DS)
 DA.dispose
 CN.close
 Dim Iint as Integer = 0
 Dim str as String
 If TxtMode.Text = "A" Then
 For Iint = 0 to ds.Tables(0).Rows.Count - 1
 str= Trim(Cstr(DS.Tables(0).Rows(Iint).Item(0)))
 'CmbBank.Items.Add(DS.Tables(0).Rows(Iint).Item(0))
 Debug.Print(str)
 Next
 End If

are your columns in the record

Minimalist 96 Posting Pro

Additional info: The addhandler handles events during runtime for my labels I have created during runtime. See also the following link:
http://msdn.microsoft.com/en-us/library/7taxzxka.aspx

Minimalist 96 Posting Pro

Thats how I handle some of the Addhanlers:

AddHandler lab.Click, AddressOf labMouseClick
                    AddHandler lab.DragEnter, AddressOf labDragEnter
                    AddHandler lab.MouseDown, AddressOf labMouseDown
                    AddHandler lab.DragDrop, AddressOf labDragDrop
                    AddHandler lab.MouseUp, AddressOf labMouseUp
                    AddHandler lab.MouseMove, AddressOf labMouseMove
                    Me.Controls.Add(lab)
Minimalist 96 Posting Pro

O.K here are 2 different approaches: The first from the last link:

Dim rdr As OleDbDataReader = cmd.ExecuteReader()
        Do While rdr.Read
            lvwResults.Items.Add(New ListViewItem({rdr("au_lname"), rdr("au_fname"), rdr("phone")}))
        Loop

and the other I am using at the moment:

 oledbAdapter.SelectCommand = New OleDb.OleDbCommand(statement.CommandText, conn)
            oledbAdapter.Fill(ds)
            oledbAdapter.Dispose()
            conn.Close() 'only retruns blocknames

                For i = 0 To ds.Tables(0).Rows.Count - 1
                    str = CStr((ds.Tables(0).Rows(i).Item(0)))
                    TBlocks.ComboBox1.Items.Add(str)
                Next
Minimalist 96 Posting Pro

Well, try the same loop as before and see if it works.

Minimalist 96 Posting Pro

You do need to learn the syntax of the net framework. Here is good start of how to handle the combobox methods:
http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox(v=vs.110).aspx

Minimalist 96 Posting Pro

This might be what you are looking for:
http://vbcity.com/forums/t/103763.aspx

adam.wolnikowski.9 commented: Exactly what I'm looking for, but again, outdated...I guess I'm going to have to translate that code to 2013. +0
Minimalist 96 Posting Pro

There are a few pitfalls working with dates as it always depends on how the compiler works these and can make decisions on what it thinks you want. ALso if you want to compare just numbers you will see that four comes before one because f goes when sorting before o. So generally speaking google as much as you can digest about some of th code if something goe wrong. Please mark this thread as solved.Thanks

Minimalist 96 Posting Pro

Why don't you use datedifference function?
http://msdn.microsoft.com/en-us/library/b5xbyt6f(v=vs.90).aspx

Minimalist 96 Posting Pro

Maybe this is what you want?

Dim x As Integer = PictureBox1.Width
        Dim y As Integer = PictureBox1.Height
        Dim bm As New Bitmap(x, y)

        PictureBox1.DrawToBitmap(bm, New Rectangle(0, 0, x, y))

        PictureBox2.Image = bm
Minimalist 96 Posting Pro

Replace line 14 with all of the following code:

 If st = "zero" Then
                lbl.Text = st & "  0"
            Else
                If st = "one" Then
                    lbl.Text = st & " 1"
                else
                    lbl.Text = st
                End If
            End If
Minimalist 96 Posting Pro

look at line 14, put an if statement in and lbl.Text = st & " 0".
Don't forget to mark the thread as solved. Thanks

Minimalist 96 Posting Pro

@ cambalinho
Why don't you create a project, 2 textboxes and copy my code into the key_down event in the first textbox. It works perfect as you only catch the enter event and nothing else.

Minimalist 96 Posting Pro

@ cambalinho
Read the OP's question carefully and before telling me my code is incomplete try it first and put it in the correct event, keydown on textbox1.

Minimalist 96 Posting Pro

You can use something like this:

    Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown
        If e.KeyCode = Keys.Enter Then
            TextBox2.Focus()
        End If
    End Sub
Minimalist 96 Posting Pro

Just put an
if i= 0 then
put label location for the first label
end if

Minimalist 96 Posting Pro

The problem lies with you assigning the currentRow to items.count. You need to find the currentRow based on some criteria - this is only pseudo:
dim intCount ,i as Integer
intCount=.....Row.count
for i = 0 to intCount-1
if ...text= ..Row(i).items.text then
currentRow=...Row(i)
next
So basically you need to find the current row and then do your stuff.

Minimalist 96 Posting Pro

The code works fine

Private Sub Command1_Click()
If Text1.Text = "This" And Text2.Text = "That" And Text3.Text = "Those" Then
MsgBox ("1")
ElseIf Text1.Text = "This" And Text2.Text = "That" And Text3.Text = "Those" Then
MsgBox ("2")
Else
MsgBox ("Failed")
End If
End Sub

Private Sub Form_Load()
Text1.Text = "This"
Text2.Text = "That"
Text3.Text = "Those"
End Sub

don't forget the brackets around the msg. Also you will never enter the elseif if thats exactly the same as in the if statement

Minimalist 96 Posting Pro
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim strComNAme As String = "DT-WAR-BISMITH"
        Dim strEx As String = "SMITH"
        If strComNAme.Contains(strEx) Then
            Debug.Print("Found")
        End If
    End Sub

O.K. this code works. Contains is case sensitive and I think you want to find the person name within th wcomputer name and not vise versa.

Minimalist 96 Posting Pro

Sorry I was too hasty, you do already.

Minimalist 96 Posting Pro

You don't need the split method. Use the contain method. See the examples here:http://www.dotnetperls.com/contains-vbnet

Minimalist 96 Posting Pro
For i As Integer = Me.Controls.Count - 1 To 0 Step -1
    If TypeOf Me.Controls(i) Is Label Then
        Me.Controls.RemoveAt(i)
    End If
Next
Minimalist 96 Posting Pro

My 2 last posts didn't display so I try again. Just insrt my code into a new project and play around with the labels.

Imports System.Drawing.Color
Public Class Form1
    Inherits System.Windows.Forms.Form
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Dim testStr As String = TextBox1.Text
        Dim st As String
        Dim po As Integer = 10
        For i = 0 To testStr.Length - 1
            st = CStr(GetRootNumberWord((CInt(Val(testStr(i))))))
            Dim lbl As New Label
            lbl.Text = st
            lbl.BackColor = Aqua
            lbl.Location = CType(New System.Drawing.Size(po + i, 30 * i), Point) 'position of label
            Me.Controls.Add(lbl)
        Next
    End Sub


    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Me.Close()
    End Sub
    Public Enum RootNumbers
        zero
        one
        two
        three
        four
        five
        six
        seven
        eight
        nine
    End Enum
    Public Shared Function GetRootNumberWord(ByVal number As Integer) As String
        Return [Enum].GetName(GetType(RootNumbers), number)
    End Function
End Class
Minimalist 96 Posting Pro
Dim value1 as string="Item1 1"
Dim value2 as string=value1.Replace(" 1","Yes")
Minimalist 96 Posting Pro

I very much recommend to read through this tutorial beause you are not following procedures of getting the recordset etc.
http://visualbasic.freetutes.com/learn-vb6-advanced/lesson8/p24.html

Minimalist 96 Posting Pro

Your msgbox will always display because it is not in any of the conditions but executes within the flow of the program. You need to put it where you want to display the msg. If the rest is working please mark the thread as solved. Thanks

Minimalist 96 Posting Pro

O.K. just go back to your original question. You want to use two input boxes to get two values. Look at my original post and then look at your last code.

msg = InputBox("ENTER PROD_DATE", "FIND")
msg = InputBox("ENTER SHIFT", "LOCATE")

So msg ony holds your shift. Then look at your code here:

If StrComp(Adodc1.Recordset.Fields("Prod_Date"), msg, vbTextCompare) = 0 Then
If StrComp(Adodc1.Recordset.Fields("Shift"), msg, vbTextCompare) = 0 Then

where you only search for "Shift" because thats what you assingned it as you useonly one variable =msg.

Minimalist 96 Posting Pro

Sorry copied the wrong line the first trime. What I tried to point out is that you never use msg1 in your search.

If StrComp(Adodc1.Recordset.Fields("Shift"), msg, vbTextCompare) = 0 Then

I think you wanted to use msg1 here.

Minimalist 96 Posting Pro
If StrComp(Adodc1.Recordset.Fields("Prod_Date"), msg, vbTextCompare) = 0 Then

If StrComp(Adodc1.Recordset.Fields("Prod_Date"), msg1, vbTextCompare) = 0 Then

instead of msg shouldn't it be msg1

Minimalist 96 Posting Pro

Well you want to prompt for two pieces of input, so use two input boxes.

Dim msg1, msg2 As String
line 16   msg = InputBox("ENTER PROD_DATE", "FIND")
line17    msg1 = InputBox( "Enter Shift", ?)

So you catch the second prompt in msg1

Minimalist 96 Posting Pro

Why don't you just show a second one? Like:

Private Sub Form_Load()
Dim msg1, msg2 As String
msg1 = InputBox(prmpt1)
msg2 = InputBox(prmpt2)
Debug.Print (msg1 & "   " & msg2)
End Sub
Minimalist 96 Posting Pro

Well if this works well done. Please mark the thread as solved. Thanks

Minimalist 96 Posting Pro

if you got a solution please mark the thread as solved. Also, you wouldn't need my array because you are feeding the values from your database. Also check out dynamic arrays and how to resize these without loosing data.

Minimalist 96 Posting Pro

Can you show some code so we know where it has to go - buton click, key event ?