Microsoft Excel code for save name and check it exists

Tags:
Microsoft Excel 2003
VB.NET
Hi sir, I need one code sir that will create one Excel file to save name and mail ID and then check that it  already exists by using VB.NET and Excel.


Software/Hardware used:
visual studio 2010,microsoft excel 2003
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • saranyaumasankar
    Imports System.IO
    Public Class Form1
        Dim FILE_NAME As String = "C:\ID.txt"
        Dim DemoID As Integer
        Dim exists As Integer
        Dim a As StreamReader
        Dim b As String
        Dim c As String = "C:\Users\comp\Desktop\Demo\ID.txt"
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            If Not File.Exists(c) Then
                Dim d As FileStream
                d = File.Create(c)
                d.Close()
            End If
        End Sub
        Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

        End Sub
        
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            If Not TextBox1.Text = Nothing Then
                File.AppendAllText(c, TextBox1.Text & vbCrLf)
                TextBox1.Text = " "
                MsgBox("Demo ID is added successfully", MsgBoxStyle.OkCancel)
                ReadFile()
                TextBox1.Clear()
            End If

        End Sub
        Private Sub ReadFile()
            Try
                ComboBox1.Items.Clear()
                a = File.OpenText(c)
                While a.Peek <> -1
                    b = a.ReadLine()
                    ComboBox1.Items.Add(b)
                End While
                a.Close()
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End Sub


    End Class


    how to get the saved data is already exists or not ? please help me 



    25 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: