Oxiegen 88 Basically an Occasional Poster Featured Poster

Perhaps you should take a look at XML files.
You can both import and export them into a datatable for manipulation.

Oxiegen 88 Basically an Occasional Poster Featured Poster

If you have access to the server, and it's on a IIS.
You can create a webservice with a property that provides the image as a byte array on request.
That way, you can downsize the amount of coding required in the client and leave it up to each developer of mobile apps on how to handle image presentations.
And it would not require a logon to the ftp-server.

Oxiegen 88 Basically an Occasional Poster Featured Poster

The first thing you should do, is to use ADO.NET System.Data.SqlClient instead of Odbc. That might be cause of the problem.
Otherwise the code looks good.
Take a look at this for reference.

Oxiegen 88 Basically an Occasional Poster Featured Poster

I believe you would have more success with attachments if you only use the built-in mail functions in .NET, instead of relying on the default mail client.
Especially in the mixed mail client environment.

But, if you knew that everyone using your program is using Microsoft Outlook, you can add a reference to Microsoft.Office.Interop.Outlook and create an object instance of Outlook.
From there you can utilize those available properties and methods both for creating an email with attachments and to send the mail.

Imports Microsoft.Office.Interop

Private Sub SendMessage()
    Dim oEmail As New Outlook.Application
    Dim oMsg As Outlook.MailItem

    oMsg = oEmail.CreateItem(Outlook.OlItemType.olMailItem)
    oMsg.To = "backstback@hotmail.com"
    oMsg.Subject = strSubject
    oMsg.Body = strBody2
    If System.IO.File.Exists(fileName) Then
        oMsg.Attachments.Add(fileName)
    End If
    oMsg.Send()
    oMsg.Display()
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

Does 'cust_name' exist in the returning table?
Does the error occur on the first iteration or later?

See what happens if you expand the Try..Catch with a Finally and put objRead.Close() and cnSQL.Close() inside that.

Oxiegen 88 Basically an Occasional Poster Featured Poster
Dim printdialog1 As New PrintDialog
Dim result As DialogResult
result = printdialog1.ShowDialog
If result = DialogResult.Cancel Then
    'Do some tracking here
End If
Oxiegen 88 Basically an Occasional Poster Featured Poster

Do this instead:

Dim newElement As New XElement("cp:prop", New XAttribute("name", "given_name"), New XAttribute("value", givenName)))
Oxiegen 88 Basically an Occasional Poster Featured Poster
Oxiegen 88 Basically an Occasional Poster Featured Poster

Multiple posts.

Remove this thread.

Oxiegen 88 Basically an Occasional Poster Featured Poster

That errormessage indicates that something's hinky with the database file itself.
I found this articel in the MS KB.
http://support.microsoft.com/kb/184988

Oxiegen 88 Basically an Occasional Poster Featured Poster

Ok.
Well. There are tons of sites that can provide both general and advanced information about developing in VB.NET.
All you have to do is Google with the phrase "vb.net getting started".

Here's a sweet and nifty one that provides a "Getting Started" point of view.
http://www.homeandlearn.co.uk/net/nets1p1.html

Oxiegen 88 Basically an Occasional Poster Featured Poster

That's what you usually do. :)

Please mark this thread as solved if this was helpful.

Oxiegen 88 Basically an Occasional Poster Featured Poster

You can use Application.StartUpPath when working with folders originating from the application folder.
Application.StartUpPath gives you the full path for the application executable without the executable file.

Then it's a simple matter of string concatination.

Dim fileName As String = Application.StartupPath & "\subfolder\filename.txt"
Oxiegen 88 Basically an Occasional Poster Featured Poster

Please explain.
What do you mean by "Front end_ VB.NET"?

Oxiegen 88 Basically an Occasional Poster Featured Poster
Dim row1 As String = datagridview1.Rows(0).Cells(0).Value
Dim row2 As String = datagridview1.Rows(1).Cells(0).Value
Dim row3 As String = datagridview1.Rows(2).Cells(0).Value
Dim row4 As String = datagridview1.Rows(3).Cells(0).Value
Dim row5 As String = datagridview1.Rows(4).Cells(0).Value
Dim row6 As String = datagridview1.Rows(5).Cells(0).Value
Oxiegen 88 Basically an Occasional Poster Featured Poster

Add a constructor to the recieving form that takes a DateTime as argument.
Then, in the method of the calling form that opens that new form:

Dim frm As New nameOfForm(monthcalendar1.SelectionStart)
frm.Show()
frm.Dispose()
Oxiegen 88 Basically an Occasional Poster Featured Poster

Assuming that you're using the CrystalReportViewer.

Imports System.Data.OleDb
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Data

Public Class Reports
    Private objRpt As New CrystalReport1

    Public Sub ReportLastRecord()
        Dim con As OleDbConnection
        Dim connectionString As String = "<your connectionstring>"
        Dim sql As String
        sql = "SELECT TOP 1 * FROM (SELECT * FROM <table> ORDER BY id ASC)"

        con = New OleDbConnection(connectionString)
        con.Open()

        Dim da As New OleDbDataAdapter(sql, con)
        Dim dt As New DataTable("LastRecord")
        da.Fill(dt)
        con.Close()

        objRpt.SetDataSource(dt)
        CrystalReportViewer1.ReportSource = objRpt
        CrystalReportViewer1.Refresh()
    End Sub
End Class
Oxiegen 88 Basically an Occasional Poster Featured Poster

Then I'm sorry I couldn't be of any help. :)
I have no fresh, or good, ideas of how to solve this.

Oxiegen 88 Basically an Occasional Poster Featured Poster

I'm not all that familiar with Crystal Reports, but I'm guessing that you still need to query the database.
Here's how:
SELECT TOP 1 * FROM (SELECT * FROM <table> ORDER BY id ASC)

This syntax is necessary in an access database in order for the query to be successful.

Oxiegen 88 Basically an Occasional Poster Featured Poster

If you're connecting to a networked SQL server, then perhaps the problem is the credentials.
If you're connecting through Windows Authentication, then other users may not have access to the server.
You should create a dedicated user on the SQL server, and use that account in the connectionstring for connecting to the server.

If you're using MS SQL Server Express, then this will be a good read:
http://msdn.microsoft.com/en-us/library/bb264562(SQL.90).aspx#emsqlexcustapp_topic4

Oxiegen 88 Basically an Occasional Poster Featured Poster

It helps if you google it.
Here's an answer: http://www.daniweb.com/forums/thread106514.html

Oxiegen 88 Basically an Occasional Poster Featured Poster

You will spend a whole lot less memory by using the .NET built-in classes for dealing with database connectivity.
More to the point, the OleDb namespace.

Your method will in practice open up a virtual instance of Access.
The .NET method only open up a connection to the database file through a connectionstring.
The connectionstring can be changed depending on what button is pressed.

Oxiegen 88 Basically an Occasional Poster Featured Poster
Oxiegen 88 Basically an Occasional Poster Featured Poster

A field in the SQL Select query with a datatype of Bit should give you a checkbox in the DataGridView.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Did you create that database folder inside your projectfolder?
Did you move the database file into that folder?
Did you include that folder in your project?
Does the path part of the connectionstring start with a dot slash (.\)?

Oxiegen 88 Basically an Occasional Poster Featured Poster

I've had very much success using Advanced Installer.
It's very easy to use.
You simply import the compiled files from the VS project, and fill out a few textfields, and then hit the Build button.

Oxiegen 88 Basically an Occasional Poster Featured Poster

The computer already installed with MS Access. But it is a trial version which already expired. will this affect to my software?

It doesn't matter. You can uninstall it.

my connection string is like this : "|DataDirectory|\RMA.accdb"

Then your connectionstring should look something like this:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=.\DataDirectory\RMA.accdb;Persist Security Info=False;

If you get any problems with the connectionstring, then have a look at this: ConnectionStrings.com

Oxiegen 88 Basically an Occasional Poster Featured Poster

Here's an idea I posted in another thread.
Create a folder in your project folder and put the access database file in it.
Then, include that folder in your project.

Use that folder as a reference in the connection string: ".\<databasefolder>\<database file>", instead of "C:\<somefolder>\<databasefile>". (Notice the dot in the beginning).

When you rebuild the project, that folder containing the database file will be copied to the build output folder along with the exe.
Then just copy the files and folder to where ever you want.

When you run the program, it will always know that the database is in a sub-folder from where it's running. Be it on a hard-drive or a USB memory stick.

You shouldn't need to install the complete MS Access program in order to make this work.

Oxiegen 88 Basically an Occasional Poster Featured Poster

preetbrar.
If you wish to ask a question on this forum, please create a new thread.
Don't hijack someone else's.
Read through the Member Rules.

Oxiegen 88 Basically an Occasional Poster Featured Poster

There is no doubt that Visual Studio can create EXE files for VB.
And if you perform a Release build, there is no need to go through the Publish Project wizard.

The Release-compiled EXE is located in the bin/Release folder.
bin/Debug contains a debug compiled version used for... debugging.

And as far as the Access database connectivity is concerned, just create a folder within the project containing the Access database file and include the folder in the project. Use this path when setting up the connectionstring: ".\<databasefolder>\<databasefile>"

When you compile your project, that folder will be copied to the bin/Release folder during the build.
After all is said and done, just copy the contents of the bin/Relase folder to wherever you want, even a memory stick, and it will still work.

Oxiegen 88 Basically an Occasional Poster Featured Poster

If you Release-compiled your program, then there is no need to install "vb".
You do, however, need to install the .NET Framework version for which your program is developed with.

Other then that, just make sure that your Access database is in the same folder as your exe.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Import the source XML into a DataTable.
Then you can use the Select() method to filter out what you're looking for.
The result can then be exported into a new destination XML.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Have a look at the "NET SEND" command.

Shell("NET SEND <ip or computername> <message>")
Oxiegen 88 Basically an Occasional Poster Featured Poster

Why not use the My namespace? My.User.Name .
It gives the name of the currently logged on user and would save you a whole shrew of coding.

Oxiegen 88 Basically an Occasional Poster Featured Poster

First of all, I'm recommending that you download and install the MySQL Connector for .NET, instead of using ODBC. It's available from the MySQL site.

Then, for inserting data into the database will be practically the same as using a MS SQL database.

Imports Mysql.MySqlClient

Private Sub MainForm_Load(yadda yadda yadda)
   Dim connectionString As String = "<connectionstring>"
   Dim con As New MysqlConnection(connectionString)

   con.Open()

   Dim com As New MysqlCommand("INSERT INTO <table> (field1,field2) VALUES (value1,value2)", con)
   If com.ExecuteNonQuery() = 0 Then
      MessageBox.Show("No recoords stored at this time")
   End If
   con.Close()
End Sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

Try this:

Imports System.Data.OleDb
   Imports System.Text

   Public Class mainpage : Inherits System.Windows.Forms.Form
      Dim con As New OleDb.OleDbConnection
      Dim cmdOle As New OleDb.OleDbCommand
      Dim da As OleDb.OleDbDataAdapter
      Dim dtOle As DataTable
      Dim sql As String


      Private Sub find_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles find.Click

         con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\HARTI_RES_PRO.accdb;")
         con.Open()

         Dim whrCond As StringBuilder
         whrCond = New StringBuilder()
         whrCond.Append(" where ")
         Select Case ComboBox.SelectedItem
            Case "Researcher's Name":
               whrCond.Append(" Researcher LIKE '%" & TextBox1.Text & "%'")
            Case "Project title":
               whrCond.Append(" Project_title LIKE '%" & TextBox1.Text & "%'")
            Case "Project code":
               whrCond.Append(" Code LIKE '%" & TextBox1.Text & "%'")
            Case "Division":
               whrCond.Append(" Division LIKE '%" & TextBox1.Text & "%'")
            Case "Co-researchers":
               whrCond.Append(" Co_Researchers LIKE '%" & TextBox1.Text & "%'")
            Case "Source of funding":
               whrCond.Append(" Source_of_funding LIKE '%" & TextBox1.Text & "%'")
         End Select

         sql = "select * from QAruni" & whrCond.ToString()
         cmdOle = New OleDbCommand(sql, con)

         dtOle = New DataTable("QAruni")
         da = New OleDb.OleDbDataAdapter(cmdOle)
         da.Fill(dtOle)
         con.Close()

         DataGridView1.DataSource = dtOle
         DataGridView1.ReadOnly = True
      End sub
Oxiegen 88 Basically an Occasional Poster Featured Poster

I understand. Forgive my presumption. :)

Ok. So what does the first error say?
Is excelPathName a valid path and filename?

Oxiegen 88 Basically an Occasional Poster Featured Poster

You might wanna look into the SNMP protocol.
However, it would be quite pointless unless your switches are of the Managed type.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Yeah. Why not look into OleDb instead?
With OleDb you can treat the Excel file as a Database source, and from there import the information into DataSets and DataTables.
Which in turn can be used as datasource for your DataGridView.

Oxiegen 88 Basically an Occasional Poster Featured Poster

You do need a licence for Visual Studio 2005 Professional Edition.
But if you have already created a program using VB.NET, then you are the owner of said program and thus don't need any type of licence.

So to answer your question:
You don't need Visual Studio in order to run your own program.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Change this
SELECT TOP 1 DesID FROM dbo.hrEmpDesignation ORDER BY DesID
Into this
SELECT TOP 1 DesID FROM dbo.hrEmpDesignation ORDER BY DesID DESC

This will change the order so that the latest/greatest id will be the one selected.

Oxiegen 88 Basically an Occasional Poster Featured Poster

You're welcome. :)

Oxiegen 88 Basically an Occasional Poster Featured Poster

You can still have a DateTimePicker control on your form.
And if you wish it to be the last thing entered before adding data to the DataGrid, all you have to do is move the code previously in the SelectedIndexChanged event of the combobox into the ValueChanged event of the DateTimePicker.

When that is done, add these lines to the code that adds to the DataGrid.

cell = New DataGridViewTextBoxCell
        cell.Value = DateTimePicker1.Value.ToShortDateString
        row.Cells.Add(cell)

And also an additional line &= ";" & row.Cells(x).Value.ToString() to the SaveToFile method.

Dcurvez commented: this is by far more than ever expected..thank you 100000000000 hundred times over :) +1
Oxiegen 88 Basically an Occasional Poster Featured Poster

Good that it works for you.
Please mark the thread as solved unless you're stuck.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Very nice. Progress!

I guess now, all you have to do is fidget with the SaveToFile method and try to see what happens if you replace the semi-colon with a comma.
Or see what happens if you first start Excel and open the CSV file from there.

Excel should automatically detect that it is a CSV file your opening and separate the fields into cells.

Oxiegen 88 Basically an Occasional Poster Featured Poster

You're welcome.
Please mark this thread as solved if you have no other questions.

Oxiegen 88 Basically an Occasional Poster Featured Poster

How about something like this.

Dim line As String
            Dim Input As StreamReader
            Dim PolicyIdCode As String
            Dim strFile As New ArrayList

            PolicyIdCode = TextBox19.Text

            Input = File.OpenText("Policy Details.txt")

            ' Loop through the file
            While Input.Peek <> -1
                ' Read the next available line
                line = Input.ReadLine

                ' Check to see if the line contains what you're looking for.
                ' If not, add it to an ArrayList
                If Not line.Contains(PolicyIdCode) Then
                    ' If not, add it to an ArrayList
                    strFile.Add(line)
                End If
            End While

            Input.Close()

            ' Because we want to replace the content of the file, we first
            ' need to delete it.
            If File.Exists("Policy Details.txt") Then
                File.Delete("Policy Details.txt")
            End If

            ' Create a StreamWriter object with the same filename
            Dim objWriter As New System.IO.StreamWriter("Policy Details.txt", True)
            ' Iterate through the ArrayList
            For Each item As String In strFile
                ' Write the current item in the ArrayList to the file.
                objWriter.WriteLine(item)
            Next
            objWriter.Flush()
            objWriter.Close()

There you have it.
Go through the file and add it, line by line, to an ArrayList skipping the lines you wish to remove.
Remove the file, and create a new file with the contents of the ArrayList.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Keep the newest/current version of the project in a database.
Create a Webservice/WCF service that presents that version online and has a file copying method.
Also, create a small Updater utility that goes with your larger project.

Then add a reference in your project to the service, and compare the two version numbers.

If the presented "online"-version is newer, then shut down the system/program and execute the updater utility that copies the new version using the file copying method in the service.

By using a Webservice/WCF you don't have to worry about firewalls, since it's basically normal HTTP-communication.

Oxiegen 88 Basically an Occasional Poster Featured Poster

The ComboBox control has two properties called AutoCompleteMode and AutoCompleteSource.

Change AutoCompleteMode to Suggest and AutoCompleteSource to ListItems.

Oxiegen 88 Basically an Occasional Poster Featured Poster

I've been looking through the code and have found a bunch of coding errors. My bad!

First, for this to work properly the DataGrid needs to have columns. Which you've added already.

Next, we need to revise the code for the last combobox.

Dim row As New DataGridViewRow 'The row object
        Dim cell As DataGridViewCell = New DataGridViewTextBoxCell 'The columns

        cell.Value = ComboBox1.GetItemText(ComboBox1.SelectedItem)
        row.Cells.Add(cell)

        cell = New DataGridViewTextBoxCell
        cell.Value = ComboBox2.GetItemText(ComboBox2.SelectedItem)
        row.Cells.Add(cell)

        cell = New DataGridViewTextBoxCell
        cell.Value = ComboBox3.GetItemText(ComboBox3.SelectedItem)
        row.Cells.Add(cell)

        cell = New DataGridViewTextBoxCell
        cell.Value = ComboBox4.GetItemText(ComboBox4.SelectedItem)
        row.Cells.Add(cell)

        ' And so on

        DataGridView1.Rows.Add(row)

We also need to add two lines to the SaveToFile method:

Private Sub SaveToFile(ByVal fileName As String)
        If DataGridView1.RowCount > 0 AndAlso DataGridView1.Rows(0).Cells(0) IsNot Nothing Then
            Dim stream As New System.IO.FileStream(fileName, IO.FileMode.Append, IO.FileAccess.Write)
            Dim sw As New System.IO.StreamWriter(stream)
            For Each row As DataGridViewRow In DataGridView1.Rows
                ' This makes sure that only rows with data in it gets read.
                If row.IsNewRow = False Then
                    Dim line As String
                    line = row.Cells(0).Value.ToString()
                    line &= ";" & row.Cells(1).Value.ToString()
                    line &= ";" & row.Cells(2).Value.ToString()
                    line &= ";" & row.Cells(3).Value.ToString()
                    line &= ";" & row.Cells(4).Value.ToString()
                    line &= ";" & row.Cells(5).Value.ToString()
                    line &= ";" & row.Cells(6).Value.ToString()
                    line &= ";" & row.Cells(7).Value.ToString()

                    ' This line was missing and also why the file was empty
                    sw.WriteLine(line)
                End If
            Next
            sw.Flush()
            sw.Close()
        End If
    End Sub

As for the form closing code.
The way you have coded it will always ask whether or not you would like to save.
Add …