poojavb 29 Junior Poster

Below example is in MS SQL...same can be done in Access database just change the SQLCommant to OLEDBCommand

First open the connection and then

Dim myCommand As SqlCommand
myCommand = New SqlCommand("CREATE TABLE Tablename (col1 datatype1,col2 datatype2)", myconn) 'where myconn is the connection object
myCommand.ExecuteNonQuery()

'Keep adding the table names as many as u want
myCommand = New SqlCommand("CREATE TABLE Tablename2 (col1 datatype1,col2 datatype2)", myconn) 'where myconn is the connection object
myCommand.ExecuteNonQuery() 

.
.
.
.

CLose the connection

poojavb 29 Junior Poster

Label1 will display the number of days....

          Dim count = 0
          Dim totalDays = (DTLeavePayTo.Value - DTLeavePayFrom.Value).Days
          Dim startDate As Date

          For i = 0 To totalDays
               Dim weekday As DayOfWeek = startDate.AddDays(i).DayOfWeek
               If weekday <> DayOfWeek.Sunday Then
                    count += 1
               End If
          Next
          Label1.Text = count
poojavb 29 Junior Poster

Add a try catch block around ur sql statements and the insert sql is not correct

 cmd.CommandText = "INSERT INTO table([Name], [Comment], [emailaddress]) VALUES('" + txtname + "','" + txtcomment+ "','" + txtemail + "')"
poojavb 29 Junior Poster

The answer will be 2 only since subtracting higher to lower will give the result...if u want all the days inclusive just add 1 to ur result...

poojavb 29 Junior Poster

Try this

import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.List;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
// <applet code="AppletInterfaz" width="300" height="200"> </applet>
public class AppletInterfaz extends Applet implements ItemListener {
    List colors;
    public AppletInterfaz() {
        colors = new List(4);
        colors.add("Aqua");
        colors.add("Black");
        colors.add("Blue");
        colors.add("Fuchsia");
        colors.add("Gray");
        colors.add("Green");
        colors.add("Lime");
        colors.add("Maroon");
        colors.add("Navy");
        colors.add("Olive");
        colors.add("Purple");
        colors.add("Red");
        colors.add("Silver");
        colors.add("Teal");
        colors.add("White");
        colors.add("Yellow");
        add(colors);
        //colors.setSelectedIndex(0);
        colors.addItemListener(this);
    }
    public void itemStateChanged(ItemEvent ie) {
        repaint();
    }
    public void paint(Graphics g) {
        //colors.setSelectedIndex(colors.getSelectedIndex());
        int choice;
if (colors.getSelectedIndex()<= -1 )
{
    choice = colors.getSelectedIndex()+1;
}
else
{
    choice = colors.getSelectedIndex();
}
        System.out.println(choice);
        int red, green, blue;
        int colorMix[][] = { { 0, 255, 255 }, { 0, 0, 0 }, { 0, 0, 255 },
                { 255, 0, 255 }, { 128, 128, 128 }, { 0, 128, 0 },
                { 0, 255, 0 }, { 128, 0, 0 }, { 0, 0, 128 }, { 128, 128, 0 },
                { 128, 0, 128 }, { 255, 0, 0 }, { 192, 192, 192 },
                { 0, 128, 128 }, { 255, 255, 255 }, { 255, 255, 0 } };
        red = colorMix[choice][0];
        green = colorMix[choice][1];
        blue = colorMix[choice][2];
        Color fondo = new Color(red, green, blue);
        g.setColor(fondo);
        g.drawRect(0, 0, 300, 200);
        g.fillRect(0, 0, 300, 200);
    }
}

Actually ur choice variable gets value as -1 so it shows the error of OutofIndex....since no item is selected in the List...
bydefault select some item in the List and then assign the value to choice variable....

Kronolynx commented: thanks for the help +0
poojavb 29 Junior Poster

Every time u delete a record from the datagridview (database) make sure u load the datagridview again completely...and if suppose any data is returned then enable ur delete button else disable...

u can add the enabling and disabling of delete button in all ur control events wherever u r dealing with datagridview (database)

something like this:
this code is written in delete button click event

Dim i As Integer
          Dim ID As String
          i = DataGridView1.CurrentRow.Index
          ID = DataGridView1.Item(0, i).Value
          MsgBox("ID: " & ID.ToString)

          Dim myCommand1 As SqlCommand

          myCommand1 = New SqlCommand("DELETE FROM  Names Where ID = '" & ID & "'", Connection)
          myCommand1.ExecuteNonQuery()

          Try
               Dim myCommand As SqlCommand
               myCommand = New SqlCommand("SELECT * FROM Names", Connection)
               Dim dt As New DataTable
               dt.Load(myCommand.ExecuteReader)
               MsgBox("dt value: " & dt.Rows.Count.ToString)
               If dt.Rows.Count <= 0 Then
                    With DataGridView1
                         .DataSource = Nothing
                    End With
                    btnDelete.Enabled = False
               Else
                    With DataGridView1
                         .AutoGenerateColumns = True
                         .DataSource = dt
                    End With
                    btnDelete.Enabled = True
               End If
          Catch ex As Exception
               MsgBox(ex.Message)
          End Try
poojavb 29 Junior Poster
               Dim strSQL As String = "SELECT distinct deptid,deptname FROM tablename"
               Dim da As New OleDbDataAdapter(strSQL, Connection)
               Dim ds As New DataSet
               da.Fill(ds, "tablename")
               With combobox1
                    .DataSource = ds.Tables("tablename")
                    .DisplayMember = "deptname"
                    .ValueMember = "deptid"
               End With
poojavb 29 Junior Poster
 MessageBox.Show("WELCOME TO MAGIC BEANS INC. ^_^ :* :)) :p", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
          Dim button As DialogResult
          button = MessageBox.Show("Would you like to become a member? (note: membership fee Php 500, non-member 250 for)", Me.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information)
          If button = Windows.Forms.DialogResult.Yes Then
               Me.Show()
               'Me.Dispose(False)
          ElseIf button = Windows.Forms.DialogResult.No Then
               Form2.Show()
               Me.Dispose(False)
          End If
gelmi commented: haha laughing at myself right now. Thanks anyway :) +0
poojavb 29 Junior Poster

in which event are u writing this code???
below code works...is this what u want....type in textbox3 and get the same thing in textbox4

Private Sub TextBox3_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox3.TextChanged
          TextBox4.Text = TextBox3.Text
     End Sub
poojavb 29 Junior Poster

U have two variables

Dim total as Integer and it wont be accessible
Public tolal as Double is accessible

but in your code

 Public tolal As Double ' tolal is public
 Form18.total = Module1.dailytotalamount ' total is not public....

u have declared tolal as public but not total

Begginnerdev commented: What I figured! Very nice, pooja! +6
poojavb 29 Junior Poster
Dim bill As integer=textbox14.text
Module1.billno = bill
Form18.txtbillno = Module1.billno

txtbillno is a textbox so u are getting the error....
u need to add .Text after the textbox object

Form18.txtbillno.Text = Module1.billno
poojavb 29 Junior Poster

For updating

'Open Connection
Dim upCommand As OleDbCommand
upCommand = New OleDbCommand("Update Value set Colname ='" + Textbox1.Text + "'", Connection)
upCommand.ExecuteNonQuery()
'Close connection

For inserting

'Open Connection
Dim myCommand As OleDbCommand
myCommand = New OleDbCommand("INSERT INTO Tablename Values('" + txtID.Text + "','" + txtName.Text + "')", Connection)
Dim DBReader As OleDbDataReader = myCommand.ExecuteReader
DBReader.Close()
'Close Connection
poojavb 29 Junior Poster

Can u check if the prvider string u are entering is correct....coz ur code worked for me but I just changed my provider...

below is my connection string....

 connectionDatabase = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0.;Data Source=pacs_skan.mdb;Persist Security Info=False;")

for debugging u need to add the debug.print statements .i.e.

Debug.Print(selectedStaffName.ToString())

the debug statements can be viewed in ur immediate window
Debug -> Windows -> Immediate

there are also spaces in ur fieldnames... try giving [ ] to ur field name like [Staff ID]

Its not a good practive to give spaces in ur field names...

poojavb 29 Junior Poster

Can u show u connection code....

poojavb 29 Junior Poster

Write the below part in ur html source code of the button

 <asp:Button ID="Button1" runat="server" Text="Button" Width="141px"  OnClientClick="window.open('WebForm1.aspx', 'OtherPage','top=0, left=0, width=500, height=500, menubar=yes,toolbar=yes,status=1,resizable=yes');"/>
poojavb 29 Junior Poster

try something like this

set the y axis of the datagridview as u want....

u can also write the below code in load as well as form resize event so that if the form is resized even the controls will be resized...

          DataGridView1.Size = New System.Drawing.Size(Me.Width / 2 - 100, 300)
          DataGridView1.Left = Me.Left + 50

          DataGridView2.Size = DataGridView1.Size
          DataGridView2.Left = Me.Width / 2 + 50

          Button1.Top = Me.Height - Button1.Height - 20
          Button1.Left = Me.Width - Button1.Width - 20
poojavb 29 Junior Poster

hope this helps u

System.Text.StringBuilder sb = new System.Text.StringBuilder();
        sb.Append(<script language='javascript'>");
        sb.Append("window.open('Default2.aspx', 'CustomPopUp',");
        sb.Append('top=0, left=0, width=500, height=500, menubar=yes,toolbar=yes,status=1,resizable=yes'));

        sb.Append("</script>");
poojavb 29 Junior Poster

According to ur code u r creating the new instance of the FormX and then checking the condition.....

if u know the form name then just give the name and then the condition...dont create an instance...

poojavb 29 Junior Poster

Try this...keep the form 2 code as it is....

Imports System.IO

Public Class Form1

     Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
          If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
               Dim dbfFileFolder As String = OpenFileDialog1.FileName
               Dim stFileName As String
               Dim MyFile As FileInfo = New FileInfo(dbfFileFolder)
               stFileName = MyFile.Name
               If stFileName = "GNDITEM.DBF" Then
                    Form2.ShowDialog() 'this is my Form2
               Else
                    MsgBox("error")
               End If
          End If
     End Sub
End Class
poojavb 29 Junior Poster

as u are also using asp.net the show method dont go with it....

response.redirect is the method to redirect it to the other form in asp.net

poojavb 29 Junior Poster

when u click on the calculate button make sure that both the text boxes are not empty...if so prompt the error....

if textbox1.Text="" or Textbox2.Text="" then
    Msgbox("Mandatory Info")
else
    'ur calculation code
End If

below code u can do for entering only numbers....it has to be written in ur textbox key press event

If (Microsoft.VisualBasic.Asc(e.KeyChar) < 48) Or (Microsoft.VisualBasic.Asc(e.KeyChar) > 57) Then
      e.Handled = True
End If
If (Microsoft.VisualBasic.Asc(e.KeyChar) = 8) Then
      e.Handled = False
End If

What does ur textbox3, textbox4 and textbox5 hold???

poojavb 29 Junior Poster

mycommand.CommandText can also help u to return the entire query.....in ur debug.print.....

poojavb 29 Junior Poster

Right click on ur database and select add new database....ur new database will be different...it wont be added in ur system database...

after ur database is created right click and then select new table to add ur data....

ur tree view in database will be

Servername
    Database
        - System Databases
        - YourNewDatabase
        - and so on
poojavb 29 Junior Poster

In the key press event of the text box try writing the below code....it will allow user to enter only number and when the user will enter alphabet or any other characters it wont allow user to enter it....

 'accepts only numbers
If (Microsoft.VisualBasic.Asc(e.KeyChar) < 48) Or (Microsoft.VisualBasic.Asc(e.KeyChar) > 57) Then
      e.Handled = True
End If
If (Microsoft.VisualBasic.Asc(e.KeyChar) = 8) Then
      e.Handled = False
End If
poojavb 29 Junior Poster

As soon as u create the file, it is in open state....u need to close the object of the file and then try to load the data...

FileClose()
poojavb 29 Junior Poster

u need a read method...the reader is not able to read the data....

u r not using the read method and u are trying to get the values....that is why u are getting this error

poojavb 29 Junior Poster

try this

 icon.setIconImage(image);
poojavb 29 Junior Poster

Just an idea...

I had to save the data as INP1 - first 3 characters and last integer

We cant save the alphanumeric as integer

but what I had done was....I had one temp table....which had the integer value...
every time I need to increment the value I used to check the value in that table and update in my new table....that had datatype as varchar...so everytime it used to get incremented correctly....after the insert statement then update the temp table by 1....

poojavb 29 Junior Poster

what is the datatype??...if the datatype is varchar / text it wont increment beyond 10....same had happened with me....

I had to take int as the datatype and then increment it....

poojavb 29 Junior Poster

To take back up in .bak extension file
1. Right click on ur database name
2. Tasks -> back up -> Set the backup location and then click on OK.

To restore the .bak extension file
1. Right click on ur database name
2. Tasks ->Restore -> Database
3. Set the database name if the textbox is empty
4. Source for restore -> From database / from device
5. if from device...select the radio button and then click on browse
6. Click on Add -> then select the .bak file from ur correct path
7. Clck OK
8. Select the check box of the appropriate database from the list and click OK.

if u want to add the same in code...then do the following

Try
   If Not Directory.Exists("D:\Backup") Then
      Directory.CreateDirectory("D:\Backup")
   End If
   Dim MySQL_Connection As SqlConnection = New SqlConnection()
   MySQL_Connection.ConnectionString = "Data Source = LocalHost;Initial Catalog = Datasourcename;Integrated Security  = True"
   MySQL_Connection.Open()
   Dim myCommand As SqlCommand
   myCommand = New SqlCommand(" BACKUP DATABASE [Datasourcename] TO  DISK = N'D:\Backup\Datasourcename_full.bak' WITH FORMAT ", MySQL_Connection)
   myCommand.ExecuteNonQuery()
   myCommand = New SqlCommand(" BACKUP DATABASE [Datasourcename] TO  DISK = N'D:\Backup\Datasourcename_diff.bak' WITH DIFFERENTIAL ,FORMAT ", MySQL_Connection)
   myCommand.ExecuteNonQuery()
   MySQL_Connection.Close()
Catch ex As Exception
   Msgbox(ex.message)                      
End Try

Actually I dont know about the other two formats....

poojavb 29 Junior Poster

Static methods can not directly access any instance variables or methods but they can access them by using their object reference.
Static methods may even access private instance variables via a object reference.
All private instance variables are private to its class, they can be accessed by static methods or non-static method of the class.

poojavb 29 Junior Poster

Sure why not....

    String Dob=txtDOB.getText().trim(); 
    //get the date from the text box....trim is to remove any spaces if added

    java.util.Date CurrentDate=new java.util.Date(); 
    //declaring a variable which will store the current date

    DateFormat FormattedDate=new SimpleDateFormat("dd/mm/yyyy"); 
    //convert the date time to the format given

    String Currentformat=FormattedDate.format(CurrentDate); 
    //formatting the current date

    Dob=Dob.substring(Dob.lastIndexOf("/")+1);
    //get the index of the word from '/'

    Currentformat=Currentformat.substring(Currentformat.lastIndexOf("/")+1); 
    //get the index of the word from '/'

    String Age=String.valueOf((Integer.parseInt(Currentformat))-(Integer.parseInt(Dob))); 
    //calculating age with current date and the DOB

    txtAge.setText(Age); 
    //display the age in the Age text box

Another simple method but with static varibles

Calendar cal = new GregorianCalendar(1988, 2, 6); 
//Entering the data of birth

Calendar now = new GregorianCalendar(); 
//stores current dates value

int res = now.get(Calendar.YEAR) - cal.get(Calendar.YEAR); 
//res will contain the caluclation for difference in years

if ((cal.get(Calendar.MONTH) > now.get(Calendar.MONTH)) || (cal.get(Calendar.MONTH) == now.get(Calendar.MONTH) && cal.get(Calendar.DAY_OF_MONTH) > now.get(Calendar.DAY_OF_MONTH))) {

        // if DOB's month is greater than current date month - means bday has not yet come so subtract res
        // or ( if the month is equal in both cases then consider the dates of the month... - if bday date is more than also subtract

 res--;
}

System.out.println(res);
poojavb 29 Junior Poster

Just a guess...
ur select query does not have single inverted comma...

sql = "Select * from SRuser where Uname = '" & name & "'"
Goomba79 commented: Good help many thanks!!! +0
poojavb 29 Junior Poster

Please do read the Member rules before posting....Click Here

poojavb 29 Junior Poster

Post ur code so that we can find out where u r going wrong....

poojavb 29 Junior Poster

May be the below calculation will help u to convert the date to age

String Dob=txtDOB.getText().trim();
DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM, new Locale("en", "AU"));
java.util.Date CurrentDate=new java.util.Date();
DateFormat FormattedDate=new SimpleDateFormat("dd/mm/yyyy");
String Currentformat=FormattedDate.format(CurrentDate);
Dob=Dob.substring(Dob.lastIndexOf("/")+1);
Currentformat=Currentformat.substring(Currentformat.lastIndexOf("/")+1);
String  Age=String.valueOf((Integer.parseInt(Currentformat))-(Integer.parseInt(Dob)));
txtAge.setText(Age);
poojavb 29 Junior Poster

What is ur program actually doing??? what is present in the csv file??

poojavb 29 Junior Poster

Hello....Even I tried the code as it worked absolutely fine....both the newline and the paste part is working for me....
I tried it is Microsoft visual studio 2010 professional version

poojavb 29 Junior Poster

its not like its line..... as soon as he reached the end of the line then it wraps.....

However wrapping occurs (ie) when I finish the like till the end

poojavb 29 Junior Poster

First let me clear myself with few things....
->which database are u using
->how many columns would u have in your database
->how many columns would u have in ur csv file...
->if the column numbers are different....then from where is the other data getting populated or which column will be deducted....

poojavb 29 Junior Poster

Can you show the complete code...

poojavb 29 Junior Poster

In case u need to loop even if the user enter correct number take ur if condition one place down....

import javax.swing.JOptionPane; // Needed for JOptionPane
/**
    Chapter 3.1 Roman Numerals
 */
public class Chapter3dot1
{
    public static void main(String[] args)
    {
        int num;
        String input;
        boolean shouldContinue = true;
        while(shouldContinue) 
        {
            shouldContinue = false;
            input = JOptionPane.showInputDialog("Enter a number between 1 and 10 " +
            "and I will convert it to a Roman numeral: ");
            num = Integer.parseInt(input);
            if (num == 1)
                JOptionPane.showMessageDialog(null, "I");
            else if (num == 2)
                JOptionPane.showMessageDialog(null, "II");
            else if (num == 3)
                JOptionPane.showMessageDialog(null, "III");
            else if (num == 4)
                JOptionPane.showMessageDialog(null, "IV");
            else if (num == 5)
                JOptionPane.showMessageDialog(null, "V");
            else if (num == 6)
                JOptionPane.showMessageDialog(null, "VI");
            else if (num == 7)
                JOptionPane.showMessageDialog(null, "VII");
            else if (num == 8)
                JOptionPane.showMessageDialog(null, "VIII");
            else if (num == 9)
                JOptionPane.showMessageDialog(null, "IX");
            else if (num == 10)
                JOptionPane.showMessageDialog(null, "X");
            else { //error message
                JOptionPane.showMessageDialog(null, "Not good at following instructions?" +
                "\nI said enter a number between 1 and 10!");

            }
            if( JOptionPane.showConfirmDialog(null,
                    "Do you want to try again?",
                    "Try again?", JOptionPane.YES_NO_OPTION)
                    == JOptionPane.YES_OPTION )
                shouldContinue = true;
        };
        System.exit(0);
    }
}
poojavb 29 Junior Poster

Ok let me tell u what I have done....

I have a Datagridview in which I have added 6 columns manually through property window,,,
On button click I have the following code....but before that declare two variables

Dim rowvalue As String
Dim cellvalue(20) As String

then in button click write

Dim streamReader As IO.StreamReader = New IO.StreamReader("D:\abc.csv")
'Reading CSV file content 
While streamReader.Peek() <> -1
      rowValue = streamReader.ReadLine()
      cellvalue = rowvalue.Split(","c) 'check what is ur separator
      DataGridView1.Rows.Add(cellValue)
End While

Hope this is what u needed

poojavb 29 Junior Poster

Is this what u r looking for???

Imports System.Data.SqlClient

Public Class Form8

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim Openconnection As String
        Openconnection = Open_DB_Connection("form7 - Button1 click")
        Dim da As New SqlDataAdapter("SELECT Distinct Doctorid FROM DoctorRegister", Connection)
        Dim dt As New DataTable
        da.Fill(dt)
        With ComboBox1
            '  .Items.Add("Select")
            .DataSource = dt
            .DisplayMember = "Doctorid"
            .ValueMember = "Doctorid"
            .SelectedIndex = 0
        End With
        Debug.Print(ComboBox1.SelectedValue.ToString)
        Dim Closeconnection As String
        Closeconnection = Close_DB_Connection("form7 - Button2 click")
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        Dim Openconnection As String
        Openconnection = Open_DB_Connection("form7 - Button1 click")
        Dim myCommand As SqlCommand
        myCommand = New SqlCommand("SELECT * FROM [DoctorRegister]  where DoctorID='" + ComboBox1.Text + "'", Connection)
        Dim reader As SqlDataReader = myCommand.ExecuteReader
        While reader.Read
            TextBox1.Text = reader("FirstName") + Environment.NewLine + reader("LastName") 
            'insert number of data u need in text box with Environment.NewLine 
        End While
        reader.Close()
        Dim Closeconnection As String
        Closeconnection = Close_DB_Connection("form7 - Button2 click")
    End Sub
End Class
poojavb 29 Junior Poster

Check ur database connections....while retrieving the values from database.....

poojavb 29 Junior Poster

that I understood...what I am asking is for one combox value will the text box have one value or many values???

did u check with the code I have posted??? give it a try....

poojavb 29 Junior Poster

Does your combo box selection result return only a single value???

Check what I have done...hope it helps u....set textbox AutoCompleteMode property to SuggestAppend

Imports System.Data.SqlClient

Public Class Form6

    Private Sub Form6_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        'Open connection
        Dim strSQL As String = "SELECT Distinct ID,FirstName FROM Tablename"
        Dim da As New SqlDataAdapter(strSQL, Connection)
        Dim ds As New DataSet
        da.Fill(ds, "Tablename")
        With ComboBox1
            .DataSource = ds.Tables("Tablename")
            .DisplayMember = "FirstName"
            .ValueMember = "ID"
            .SelectedIndex = 0
        End With
        'Close connection
    End Sub


    Private Sub ComboBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        'Open connection
        Try
            Dim myCommand As SqlCommand
            myCommand = New SqlCommand("SELECT LastName FROM Tablename where FirstName='" + ComboBox1.Text + "'", Connection)
            Dim reader As SqlDataReader = myCommand.ExecuteReader
            While reader.Read()
                TextBox1.Text = reader("LastName")
            End While
            reader.Close()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        'Close connection
    End Sub
End Class

Hope it helps u....

poojavb 29 Junior Poster

This is VB.net section.... Servlet comes in Java....
This is not the correct section to post the code dear.....

poojavb 29 Junior Poster

Check if this helps u in any way....
Below code is written in Main form closing event

Private Sub frmMain_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Dim dr As Object
        If e.CloseReason = CloseReason.UserClosing Then
            dr = MsgBox("Are you sure to exit the application?", MsgBoxStyle.YesNo Or MsgBoxStyle.Question, "Hospital Management System")
            If dr = vbYes Then
                Me.Dispose() 'close the main form
                frmLogin.Show() 'shows the login form when main form closes
                e.Cancel = False 
            Else
                e.Cancel = True
            End If
        Else
            e.Cancel = True
       End If
End Sub
poojavb 29 Junior Poster

What does ur MaxVal stores??? no attachment displayed