Begginnerdev 256 Junior Poster

Here is an article that may help you.

Begginnerdev 256 Junior Poster

First of all: Whoa! That formatting was terrible.

Second of all: Try something like this:

Dim cmd as New OleDbCommand("DBCC CHECKIDENT (YOUR_TABLE_NAME_HERE, RESEED, 0)",YOUR_CONNECTION_HERE)
cmd.ExecuteNonQuery

'This will reseed the table and set the identity back to 0
Begginnerdev 256 Junior Poster

You will have to add the dll reference to your project, import it, instantiate a variable of the form's class, and then call the forms Show() sub.

Begginnerdev 256 Junior Poster

You are going to need a database backend for your application.

You will need to do the following:

1)Compose a list of things you need to store and keep track of.
a)Inventory
b)Customers
c)Ect...

2)Tear down the storage items to their most simple (atomic) state to create your tables.
a)Lookup Tables
b)Foreign Keys
c)Ect...

3)Find which database type fits your needs.
a)SQL Server
b)Oracle
c)Access
d)Ect...

4)Design your application by flowcharting then coding. ( Never code first!)

5)Design the GUI (Design it for the user, not for your preference)

6)Write/Debug the code

Now, with that being said...

You will have to determine how many user will be using this software.
If you are expecting multiple users, do not use Access as your database.
Access is a single user only database.

When connecting the database to the Application, you will have to determine what library you chose to use as the method. For example:

Jet

OleDB

SQLClient

You will need to learn the methods of creating a connection to the database.

Here is a great resource!

You will also need to study data manipulation (DataAdapters,DataSets,DataTables ect..)

I hope this points you in the right direction!

arsharma159 commented: Thanks a lot! I GOT the point I was missing!! +0
Begginnerdev 256 Junior Poster

The all mighty Google, my friend. :)

Begginnerdev 256 Junior Poster

You will want to make use of the FullName property.

Example:

   Dim di As New IO.DirectoryInfo(YourDirectoryHere)
   Dim diar1 As IO.FileInfo() = di.GetFiles()
   Dim dra As IO.FileInfo

   For Each dra In diar1
      If dra.Extension = ".csv" Then
          fileCreatedDate = File.GetCreationTime(dra.FullName) 
      End If
   Next
Begginnerdev 256 Junior Poster

You can do something like this:

   Dim di As New IO.DirectoryInfo(YourDirectoryHere)
   Dim diar1 As IO.FileInfo() = di.GetFiles()
   Dim dra As IO.FileInfo

   For Each dra In diar1
       If dra.Extension = ".csv" Then      
           'Do Work
       End If
   Next
Begginnerdev 256 Junior Poster

Can you post an image of the GUI. I am having a hard time visualizing what you are doing.

Begginnerdev 256 Junior Poster

You can try something like this:

Private Sub AddControls(ByVal lstControls As List(Of Control), ByVal tpgDestination As TabPage)
    Try
        If IsNothing(lstControls) = False Then
            For i = 0 To lstControls.Count - 1
                tpgDestination.Controls.Add(lstControls(i))
            Next
        End If
    Catch ex As Exception
        MsgBox("There was a problem adding the controls!" & vbCrLf & ex.Message & vbCrLf & ex.StackTrace.ToString)
    End Try
End Sub

Private Function Retreive_Controls(ByVal tpg As TabPage) As List(Of Control)
    Try
        Dim lstCtrl As New List(Of Control)

        For Each c As Control In tpg.Controls
            lstCtrl.Add(c)
        Next

        Return lstCtrl
    Catch ex As Exception
        MsgBox("There was a problem building the list of controls!" & vbCrLf & ex.Message & vbCrLf & ex.StackTrace.ToString)
        Return Nothing
    End Try
End Function

Then call it like:

AddControls(Retreive_Controls(TabPage1),TabPage2)

This will copy everything on TabPage1 and 'paste' it to TabPage2.
All Properties will be identical.

Begginnerdev 256 Junior Poster

I think this is probably what you want.

Begginnerdev 256 Junior Poster

Make use of the sender object of the form.

You can cast the sender to the type of your control.

  Dim cntrl As New Type
  cntrl = TryCast(Sender,Type)
Begginnerdev 256 Junior Poster

Could also do something like this:

For Each line As String in System.IO.File.RealAllLines("input.txt")
    Dim lstData As New List of String
    lstData = line.Split(vbTab).ToList

    For i = 0 To lstData.Count - 1
        outFile.WriteLine(lstData(i))
    Next
Next
Begginnerdev 256 Junior Poster

By using a time span.

Something like this:

    Dim dat1 As DateTime = #10/11/2012 9:00:00 AM#
    Dim dat2 As DateTime = #10/11/2012 5:00:00 PM#

    Dim datDif As TimeSpan = dat2 - dat1

datDif will return a value of 08:00:00 or 8 hours.

Begginnerdev 256 Junior Poster

Here is an article on MSDN that has code to do exactly what you are wanting.

Hope this helps

Begginnerdev 256 Junior Poster

Only in log out.

Begginnerdev 256 Junior Poster

Unfortunately, uppon contacting SAP - They stated they could help us. (For a "small" fee)

Therefore, we simply installed it on the client pc.

Begginnerdev 256 Junior Poster

Remove the line:

TimeSheetListView.Items.Add(lviNew)

You are adding the item to the listview item that exists, then adding another.

Begginnerdev 256 Junior Poster

Can you post your code as is?

Begginnerdev 256 Junior Poster

Can you post the section of code you are using to add it to the list view?

So far, I can't see where you add it to your listview.

I see where you create the item, but you need to add it.

ListView1.Items.Add(lv)
Begginnerdev 256 Junior Poster

When creating listview items, the format will look like this:

|FirstColumn|SecondColumn|ThirdColumn|ForthColumn|ect..

.Text|SubItem(0)|SubItem(1)|SubItem(2)|ect...

So when loading data into a new listview item:

'This data will look like:
' |Hello|World|In|VB| in the listview's columns
Dim lviNew As New ListViewItem

With lviNew
   .Text = "Hello"
   .SubItems.Add("World")
   .SubItems.Add("In")
   .SubItems.Add("VB")
End With

ListView1.Items.Add(lviNew)

So with this being said, you need to format your listview with a unique value in the columns. Something you can reference. Should look something like:

'Place this code in the login button.

With lviNew
    .Text = EmployeeNumber.Text
    .SubItems.Add(Now.Date)
    .SubItems.Add(InTextBox.Text)
End With

'This will look something like this:
 |0|10/11/2012|9:00AM|

 'Now, to reference it to add the logout on the logout button's click do this:

 For Each lviItem as ListViewItem in ListView1.Items
     If lviItem.Text = EmployeeNumber.Text Then 'Your unique value here
         lviItem.SubItems.Add(OutTime.Text)
     End If
 Next

Hope this helps.

Begginnerdev 256 Junior Poster

You can split the contents of the textbox, storing them in list (of string) and remove the element, then rebuild the string.

Example:

    Dim str As New List(Of String)

    'Assuming you are using a , seperator.
    str = TextBox1.Text.Split(",").ToList

    str.Remove("test")

    For i = 0 To str.Count - 1
        If i < str.Count - 1 Then
            TextBox1.Text &= str(i) & ","
        Else
            TextBox1.Text &= str(i)
        End If
    Next

    'When "This,is,a,test,string is passed into - "This,is,a,string" will be returned.
Begginnerdev 256 Junior Poster

Try something like this in your login button's click event:

With lviNew
    .Text = Now.ToShortDateString
    .SubItems.Add(Now.ToShortTimeString)
End With

ListView1.Items.Add(lviNew)
Begginnerdev 256 Junior Poster

Try something like this:

For Each lviItem As ListViewItem In ListView1.Items
    If lviItem.Text = ComboBox1.Text Then
        TextBox1.Text = lviItem.SubItems(0).Text
        TextBox2.Text = lviItem.SubItems(1).Text
    End If
Next
Begginnerdev 256 Junior Poster

Try something like this:

Dim lviNew As New ListViewItem

With lviNew
    'NOTE:
    ' I always assign my unique values to the .Text property.
    ' This will make it easier to compare against a database.
    .Text = TextBox1.Text
    .SubItems.Add(ComboBox1.Text)
End With
Begginnerdev 256 Junior Poster

Are you posting a code contribution, or requesting help?

If you are requesting help, it might be wise to ask a question when you post. =)

Begginnerdev 256 Junior Poster

You could create some functions that cast the data entered to the type.

Just check for failures, and then prompt the user with the problem.

Something like this:

Private Function CheckIfInteger(ByVal sVal As String)
    Try
        Cint(sVal)
        Return True
    Catch ex As Exception
        MsgBox(ex.Message & vbcrlf & "Please check data entered! '" & sVal & "' is invalid!")
        Return False
    End Try
End Sub

Just create one for each data type, and halt on error. (False value returned)

As for the NullReference. I am not sure where you get this declaration:

Dim drpub As _books_Fall2012_A2DataSet.PublishersRow

Do you have a class named "_books_Fall2012_A2DataSet"?

I think what you are wanting is Something like this:

'***DISCLAIMER***
'Can't test this code, so I can tell if it works or not.
Dim drpub As New String() {_books_Fall2012_A2DataSet.PublishersRow}
Begginnerdev 256 Junior Poster

This is going to sound rude, but are you a student?

If so, then you need to listen more in class.

.sln

A solution file. This is the project file for Visual Studio. This contains the uncompiled project and resources. When you compile and run the project, an executable is made. If you feel like you are finished with an application, publish it.

Deploying Applications

Begginnerdev 256 Junior Poster

Hello!

I seem to have a bit of a problem here. I deleted my old avatar ( to search for one of a better quality ) and now I can not upload the new avatar.

Uppon saving the avatar, I receive the error message:

"There was a problem moving the image to it's final destination"

Paraphrasing, of course.

Begginnerdev 256 Junior Poster

Thanks Dragon. I will close this thread and jump on the other.

Sorry for double post.

Begginnerdev 256 Junior Poster

Something like this would do the trick:

"INSERT INTO destinationTable(Itemname,Itemcode)" & _
  "SELECT sourceTable.ItemName, sourceTable.ItemCode " & _
   "FROM sourcetable WHERE sourcetable.Column=Value"
Begginnerdev 256 Junior Poster

Hello!

I seem to have a bit of a problem here. I deleted my old avatar ( to search for one of a better quality ) and now I can not upload the new avatar.

Uppon saving the avatar, I receive the error message:

"There was a problem moving the image to it's final destination"

Paraphrasing, of course.

Has anyone else had this problem?

Begginnerdev 256 Junior Poster

I am not seeing a handler for the form close event, is something firing off - or is it not being handled?

As for currency, try this:

txtPrice.Text = CDec(txtPrice.Text).ToString("C")

As for the navigation, are you scrolling, or clicking to the next entry?

Begginnerdev 256 Junior Poster

Jim has provided ample code for displaying the item count of a listview. He has all but write the code (in project) for you. What about the code are you not understanding?

His code seems clear enough to understand. If it's the names of his variables/objects - just rename them to what you need, et voila.

Begginnerdev 256 Junior Poster

Don't post on 4 year old threads. Start another thread if you have a question you need to ask.

Begginnerdev 256 Junior Poster

Do you have any code thus far?

We can't simply do the work for you.

For all that we know, you could be asking for homework "help"

Begginnerdev 256 Junior Poster

I have searched for a distributable for the same purpose...

It came down to installing CR on the machine.

Begginnerdev 256 Junior Poster

If the quantity is an auto number, it will not be changeable.

Other than that, just wrap your values that are strings in the correct casts or 's.

Example:

'If quant is an int the listview try
Cint(Me.ListView1.Items(0).SubItems(3).Text)

'Or

OleDa.UpdateCommand.Parameters.Add("UPDATE [Inventry] SET [QTY] = [QTY] - '" & Me.ListView1.Items(0).SubItems(3).Text & "' WHERE [Item Code] ='" & Me.ListView1.Items(0).Text & "'")
Begginnerdev 256 Junior Poster

Try this:

Dim lstCourses As New List(Of Course)

This will create a list, you can add and remove elements like this:

lstCourses.Add(Courses1)
lstCourses.Remove(Courses1)
Begginnerdev 256 Junior Poster

Use a masked text box. Just set the mask and it will do the rest for you.

Example

Begginnerdev 256 Junior Poster

txtNumRows would be the name of your textbox where you want to display the count.

The (normal) naming convention for vb.net would be object type|name(camel case)

So txt = TextBox

Example:

Dim sHello As String = "Hello, World!"
'Note the s prefix

Dim iCount As Integer
'Note the i prefix

Dim bApprove As Boolean
'Note the b prefix

Therefore something named:

lblHelloWorld

Would be a label (lbl)

Begginnerdev 256 Junior Poster

If you have a host, like an Exchange server in the local netork - You can simply bouncing an email off of it.

Example

OR

If the server is configured, you can simply set a from address and bounce it off of the port/IP address.

Begginnerdev 256 Junior Poster

If you had a SMTP host on the network, you can just bounce the email off of it.

(Assuming it is configured to allow it)

Begginnerdev 256 Junior Poster

After looking at your code, I do not think that you are receiving this error from this chunk of code.

Possibility
One of your substrings from the listviewitem is a string where you are trying to store Quantity.

Can you please give an example of your data.

OR

Can you please insert a breakpoint and copy the chunk of code that is throwing the error?

Begginnerdev 256 Junior Poster

The way I normally do this would be a dataset.

Example:

    Dim con As New OleDbConnection(ConfigurationManager.ConnectionStrings("mysys.My.MySettings.ConnectionString").ConnectionString())
    con.Open()
    Dim dat As New OleDbDataAdapter(New OleDbCommand("SELECT MAX(ID_SEQ) FROM dual", con))
    Dim ds As New DataSet

    dat.Fill(ds, "Max")

    If ds.Tables("Max").Rows.Count > 0 Then
        Form4.TextBox1.Text = ds.Tables("Max").Rows(0).Item(0)
    End If
Begginnerdev 256 Junior Poster

Check your motherboard manual, simultanous beeps indicate something is wrong.

Check the manual for POST beeps

Begginnerdev 256 Junior Poster

Here is an article that explains how to use the PrintPreviewDialog object.

Begginnerdev 256 Junior Poster

If you are storing this data into a database (SQL, MySQL, Access)

Execute an update statement:

"UPDATE table SET username='" & txtUserName.Text & "', password='" & txtPassWord.Text & "',address='" & txtAddress.Text & "',city='" & txtCity.Text & "'"

Or you can parameterize the query.

"UPDATE table SET username=@username, password=@password,address=@address,city=@city"

'To enter data, just use the AddParameter function

cmd.Parameters.Add("@username",txtUserName.Text)
'ect...
Begginnerdev 256 Junior Poster

Try this:

Create a new (hidden) listview.

Store the data into the listview.

Fire the report off against the hidden listview.

Example:

'Declare the listview
Dim lvwHidden As New ListView

With lvwHidden

    'Set the columns/settings here.

End With

For Each itm as ListViewItem in ListView1.SelectedItems
    'Send each item selected to the hidden listview
    lvwHidden.Items.Add(itm)
Next

'Fire the report off against the hidden listview
Begginnerdev 256 Junior Poster

Uh oh, can you rename the image before posting?

Begginnerdev 256 Junior Poster

Open the Project Designer (My Project)

From the Application Tab

Set the Startup form by selected the form from the drop down.