Begginnerdev 256 Junior Poster

Hello my fellow DaniWebbers,

I have a discussion topic for everyone.

Winforms VS. WPF

ITT:
Your opinion on the two
Your reason for coming to that discision
Your approval/disapproval of Microsoft abandoning WinForms
How this impacts your vb.net skills

Begginnerdev 256 Junior Poster

Do you mean something like this?

    Try
        Dim myDir As String = My.Computer.FileSystem.SpecialDirectories.Desktop & "/tmpOldLoc/"
        Dim toDir As String = My.Computer.FileSystem.SpecialDirectories.Desktop & "/tmpNewLoc/"


        If Directory.Exists(myDir) = True Then
            Dim di As New IO.DirectoryInfo(myDir)
            Dim diar1 As IO.FileInfo() = di.GetFiles()
            Dim dra As IO.FileInfo
            For Each dra In diar1
                File.Copy(dra.FullName, toDir & dra.Name)
            Next
        End If

    Catch ex As Exception

        MsgBox("Something went wrong!" & vbCrLf & ex.Message)

    End Try
Begginnerdev 256 Junior Poster

Your connection string looks wrong.

Are you getting your "DataDirectory" from your vb app?

If so, your connection string should look like this.

cnn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & DataDirectory & "\Database.accdb"
Begginnerdev 256 Junior Poster

You will not be able to have child forms without having a mdiParent.

Begginnerdev 256 Junior Poster

There are multiple Mouse events.

Here is the order that the click events fire in.

MouseDown
MouseClick
MouseUp

Examples:

Private Sub MouseDownMe(sender as object, e as MouseEventArgs) handles Me.MouseDown
        MsgBox("You have clicked the mouse.")
End Sub

Private Sub MouseClickMe(sender as object, e as MouseEventArgs) handles Me.MouseClick
If e.Button = Windows.Forms.MouseButton.Left Then
    MsgBox("You have clicked the left mouse button.")
End If
End Sub


Private Sub MouseUpMe(sender as object, e as MouseEventArgs) handles Me.MouseUp
    MsgBox("You have released the mouse button."
End Sub
Begginnerdev 256 Junior Poster

That is the wildcard character.

That means that you are allowing any connection from any IP.

Do you have a user setup (with access to the database) on the Ubuntu machine?

Begginnerdev 256 Junior Poster

Is it a possibility you need to instal the mySQL adapter?

Here are the adapters available.

Begginnerdev 256 Junior Poster

Here is some one else with a similar issue.

Begginnerdev 256 Junior Poster

By browser I mean 100% custom browser. Using the browser object is just using IE.

Begginnerdev 256 Junior Poster

Ok, if I hope I understand the question...

You are:

1) Retreiving the data from a database
2) Entering the data into the active directory

Right?

Begginnerdev 256 Junior Poster

Are you using a windows or unix based system?

Begginnerdev 256 Junior Poster

Why not try your luck at a custom browser?

( I didn't see a browser in the list. )

Begginnerdev 256 Junior Poster

Almost every obect that has an index is treated as a 0th based array.

Arrays will have a terminator character to the end.

Example

Cat

cat = 3 characters, but is actually 4 after the terminator.

Therefore,

 Dim test() As String = {"c", "a", "t"}

 MsgBox(test.Length) 'Returns 3'

 MsgBox(test(0)) 'Returns c'
 MsgBox(test(1)) 'Returns a'
 MsgBox(test(2)) 'Returns t'
 MsgBox(test(3)) 'Outside of bounds. Terminator character."
Begginnerdev 256 Junior Poster

Is this for a ASP.Net question or a java applet question?

Begginnerdev 256 Junior Poster

I have another possible suggestion.

You can wrap it in a try catch, and then throw the stack trace.

Example:

Try
    'Place code here.'
Catch ex As Exception
    MsgBox(ex.StackTrace.ToString)
End Try

Then screen cap and paste here?

Thanks,
Begginnerdev

Begginnerdev 256 Junior Poster

You will want to make sure to subtract 1 from count.

Liike this:

For i As integer = 0 to Me.DtaGridXML.Rows.Count - 1
Begginnerdev 256 Junior Poster

You will need to use directory info.

Here is an example.

 Private Sub GetRandFile(sender As Object, e As EventArgs)
    Try
        Dim tmpdir As String = My.Computer.FileSystem.SpecialDirectories.Desktop
        Dim tmpar() As String



        If Directory.Exists(tmpdir) = True Then
            Dim di As New IO.DirectoryInfo(tmpdir)
            Dim diar1 As IO.FileInfo() = di.GetFiles()
            Dim dra As IO.FileInfo
            For Each dra In diar1
                tmpar = dra.FullName.Split(".")
                If tmpar(1) = ".txt" Then
                    Process.Start(dra.FullName)
                End If
            Next
        End If
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
End Sub

This can just be assigned as an event handler for a button or any control of your chosing.

Begginnerdev 256 Junior Poster

If your data column type is a Date/Time, both the DATE and the time will be stored.....

Or are you just storing the value in a varchar?

Begginnerdev 256 Junior Poster

Here is another post on the same subject.

Begginnerdev 256 Junior Poster

It may just be as simple as delcaring a new instance of the propery.

Like so:

 Dim cont As New TutorialControl
 cont.TestMessage()
Begginnerdev 256 Junior Poster

There is

UPDATE table SET column2 = column2 + 1

Begginnerdev 256 Junior Poster

One thing I almost always have to do when working with dates from SQL server, is do a string split on the data coming in, seperating the date and the time.

Dim tmp As String = dt.Rows(0).Item(0)
Dim tmpAr() As String = tmp.Split(" ")
'tmpAr(0) will be the Date'
'tmpAr(1) will be the Time'
Begginnerdev 256 Junior Poster

You will have to loop through the datagrid like a table.

Here is another question from Microsoft's Forumns.

Click Here

Begginnerdev 256 Junior Poster

Here is an entire project from CodeProject.

You can use it as a reference to help get you started.

Project

Begginnerdev 256 Junior Poster

You might also want to look into placing your code in a try catch block. From what I see, you are leaving yourself open for failures.

Begginnerdev 256 Junior Poster

Are you sure tha the text from the text boxes is being handled correctly?

One thing I do to check entered dates is a small try catch.

Try
    Dim test As Date = CDate(TextBox1.Text)
Catch ex As Exception
    MsgBox("Date incorrect!")
End Try

And for TextBox12, I am assuming it is on another form called "search"?

Begginnerdev 256 Junior Poster

Can you hit the "View Details" button on the exception window....Then screen cap and paste it here?

Begginnerdev 256 Junior Poster

You might have to try to parse the HTML content of the website.

Begginnerdev 256 Junior Poster

Here is a tutorial for you.

Begginnerdev 256 Junior Poster

Are you storing these values in a database?

I would hope so. If not, you could possibly lose all information from power loss or application exit.

Begginnerdev 256 Junior Poster

You have a couple of options for keeping records of who is logging in.
1)Database*
2)Program's Settings (XML)
3)Text FIle
4)CSV File

*The most reliable.

Begginnerdev 256 Junior Poster

Sorry, Dani.

Begginnerdev 256 Junior Poster

I see you have declared it as an overide, but do not see the declared sub that is overridden

Begginnerdev 256 Junior Poster

Any luck with your problem my friend?

Begginnerdev 256 Junior Poster

First of all, you are calling a procedure that does not exist.

From what I see, TestMessage is not a member of the property.

Begginnerdev 256 Junior Poster

Found the solution.

Had to double parse the dates.

One string split to remove the space, then another to remove the /'s

Then use the pad function to add the 0's.

On the other hand, thanks for the suggestions Bonca.

Begginnerdev 256 Junior Poster

You will need to create a counter for each index, so if there are 40 items in the combo box, you will need 40 counters.

Begginnerdev 256 Junior Poster

An index is the integer reference to the selected item.

Arrays are 0 based, meaning the first item starts at 0, and the last item will always be a terminator.

Think of comboboxes as arrays.

An index of 0 gets the item at 0 in the array.

So if you have 5 items in the combo box your array will look like...

Index 0 - Item 1
Index 1 - Item 2
Index 2 - Item 3
Index 3 - Item 4
Index 4 - Item 5

Begginnerdev 256 Junior Poster

For the application settings, you can do something like this.

'Assign a counter for each item.'
'Example:  index0Count'
'          index1Count'
'          index2Count'
'          index3Count'
'All of these will be delcared in MyProject > Settings'



'Then, from the application, in the selected index change event, place this code.'

If myComboBox.SelectedIndex = 0 Then
    If My.Settings.index0Count < 60 Then
        My.Settings.index0Count + = 1
        My.Settings.Save()
    Else
        MsgBox("You have reached your limit for this item.")
        return
    End If
ElseIf myComboBox.SelectedIndex = 1 Then
    If My.Settings.index1Count < 60 Then
        My.Settings.index1Count + = 1
        My.Settings.Save()
    Else
        MsgBox("You have reached your limit for this item.")
        return
    End If
ElseIf myComboBox.SelectedIndex = 2 Then
    If My.Settings.index2Count < 60 Then
        My.Settings.index2Count + = 1
        My.Settings.Save()
    Else
        MsgBox("You have reached your limit for this item.")
        return
    End If
ElseIf myComboBox.SelectedIndex = 3 Then
     If My.Settings.index3Count < 60 Then
        My.Settings.index3Count + = 1
        My.Settings.Save()
    Else
        MsgBox("You have reached your limit for this item.")
        return
    End If
End If

'The code will repeat until you have accounted for all of your indexes.'

Now, for the database version.

The database version will require a table with the index and counter.

Example:

'Table: Counters'
'Column1: indexID'
'Primary Key, Integer'
'Column2: count'
'Integer, Not Null'

Then, add all of the counters for the indexes.

Next, update them from the form when used.

'You will have to create a connection to the database and fill the data table.'

'example SELECT statement'
'"SELECT * FROM Counters"'
'dt = data table'

If myComboBox.SelectedIndex = 0 Then …
Begginnerdev 256 Junior Poster

Hello my fellow daniwebbers, I have yet another question.

I have a date, which is pulled from a database, that I need to convert to another form of that date.

Example.

Date1: 1/2/2001
Date2: 01/02/2001

What i am wanting to do is turn the current date format into two digit month/day with four digit year.

Here is the problem.

Upon converting the date, the return result is the format string??

What I have tried:

String.Format
String.FormatDateTime
DateTime.TryPaseExact

Anyone have any ideas?

Begginnerdev 256 Junior Poster

Here is an article on WPF issues.

Begginnerdev 256 Junior Poster

Are you creating controls on run time?

Begginnerdev 256 Junior Poster

Create a timer, delclare a public variable with the value of 30 and set the interval to 1000 miliseconds (1 second) then in the timer place the code.

public var as integer = 30

'In the timer.tick event.'

var -= 1
ballLocation = new Point(ballLocation.x, ballLocation.y - 1)

If var = 0 Then
    MsgBox("Happy New Years!")
End If

Fire this code from a start button

timer.Start()

Fire this code from the stop button

timer.Stop()
Begginnerdev 256 Junior Poster

If you are wanting to keep count even after the user closes and restarts the application, you will have to store the count in a database.

Another method would be to store it in the application settings, which is stored as an xml in the application directory.

Begginnerdev 256 Junior Poster

Sorry deceptikon, the previous post about being in the wrong forum was when it was posted in the vb.net forum.

Begginnerdev 256 Junior Poster

Do you have any timers or any code that is firing constantly?

Begginnerdev 256 Junior Poster

Place this code in the Form's mouse down event.

'On mousedown'
If e.Button = Windows.Forms.MouseButton.Left Then

Capture = True
relocateTimer.Start()

End If

Place this in the mouse up event.

'On mouseup'
relocateTimer.Stop
Capture = False

Next place this in the timer's tick event.

'Place this code in a timer.'
'Set tic to 15 milliseconds.'

dim i as integer = 0

i+= 1

If i > 15 Then
Me.location = new Point (MousePosition.x - (me.width /2 ),Mouseposition.y - (me.height /2))
End If

Now, after the user holds the mouse for 15 milliseconds, it will start to relocate.

Begginnerdev 256 Junior Poster

Don't know if anyone else here has the same feeling that I have.....

I have a feeling that this may either be a prank, or something malicious....

Am I the only one who feels this way?

Also, wrong forum.

Begginnerdev 256 Junior Poster

Update:

Some one give this man a medal!

A quick solution to the problem. Made some modifications of my own, but you can do the same.

I added some features, like customizable working directory ect...

If anyone downloads the libary and needs help adding features. Just pm me.

Begginnerdev 256 Junior Poster

Are you using an older version of a dll when using a newer's functions, or visa versa?