Friday, February 24, 2012

DATAGRIDVIEW CELL COLOR & FILTER WITH VB.NET


'**************************************************************************

'* DATAGRIDVIEW CELL COLOR & FILTER WITH VB.NET *

'**************************************************************************

' COPY PASTE THIS CODE TO FORM1

'CREATE A DATAGRIDVIEW







'CREATE A COMMAND BUTTON






'CREATE A TEXTBOX



Imports System.Data.OleDb
Public Class Form1
Dim dv As New DataView
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\data.mdb")
If cn.State = ConnectionState.Closed Then cn.Open()
Dim cmd1 As New OleDbCommand("select * from itemmast", cn)
Dim dr As OleDbDataReader
dr = cmd1.ExecuteReader
Dim dt As New DataTable
dt.Load(dr)
dt.TableName = "itemmast"
dv.Table = dt
DataGridView1.DataSource = dv
With DataGridView1
.RowHeadersVisible = False
.RowsDefaultCellStyle.BackColor = Color.LightBlue
.AlternatingRowsDefaultCellStyle.BackColor = Color.White
.EnableHeadersVisualStyles = False
.ColumnHeadersDefaultCellStyle.BackColor = Color.Green
.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
End With
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
dv.RowFilter = "partno like '%" & TextBox1.Text & "%'"
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
dv.RowFilter = "partno like '%" & TextBox1.Text & "%' or partds like '%" & TextBox1.Text & "%'"
Label1.Text = dv.Count & " Rows"
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End Sub
End Class

Saturday, February 11, 2012

object reference not set to an instance of an object

1) Run regedit.exe;
2) Browse to the location "HKEY_CLASSES_ROOT\CLSID\{F9AE8980-7E52-11d0-8964-00C04FD611D7}" in the tree;
3) If there is a child node in the tree called "ProgID", then you are indeed experiencing a different problem - let me know if this is the case.

Otherwise, follow these steps to modify the registry:

1) Right click the node and select "New > Key";
2) Enter "ProgID" as the name;
3) Go to the main window and double click "(Default)";
4) Enter the value "MSIDXS.1";

Now if you run Visual Studio, it should be working.


************************************************************************************
Regards,

Chittaranjan Satpathy

+919973661801


Wednesday, December 28, 2011

Earn Online Data Entry

Earn upto Rs. 9,000 pm with PaisaLive.com!

Hi ,

I have something interesting for you - you can easily earn regular income online via PaisaLive.com!

It’s really amazing! You get paid to open & read the contents of PaisaLive mails. You also receive special discount coupons, promotions and free passes to various events in your city.

Join now and get Rs. 99 instantly, just for joining. What more, as a special bonus you get paid for inviting your friends also!

Create your PaisaLive Account & refer your friends to earn launch referral bonus on every new registration.

http://www.PaisaLive.com/register.asp?4636259-3824958

PaisaLive - Get Paid to read emails


Tuesday, December 27, 2011

Tally Import 7.2 or Tally ERP

Insert your tally Sale Voucher /Purchase voucher directly to Tally 7.2, Tally9 or Tally.ERP9 from your any sale software database.

The compatibility has been checked with foxpro database, dbase, DBF, ms-access, SQL Server,Oracle. Need to customize to interlink with your sale software.












For customization please contact me at ranjansatpathy@gmail.com

Friday, September 23, 2011

How to create .UHA file


HOW TO CREATE .UHA FILE AND RUN AUTOMATICALLY

NEED TO DOWNLOAD UHA.EXE OR UHARC.EXE

1. create a batch file (to compress uha file)
==============================================
echo off
uha.exe a -m3 -r -pf -o sales.uha e:\sales\*.*

Note: here sales.uha is target filename
e:\sales\*.* is source folder name


2. create another batch file ( to decompress and run uha file)

uha.exe x -t"%TEMP%\Soft" -y+ sales.uha
start "" /D"%TEMP%\Soft\Sales" "sales.bat"

How to create .UHA file


HOW TO CREATE .UHA FILE AND RUN AUTOMATICALLY

NEED TO DOWNLOAD UHA.EXE OR UHARC.EXE

1. create a batch file (to compress uha file)
==============================================
echo off
uha.exe a -m3 -r -pf -o sales.uha e:\sales\*.*

Note: here sales.uha is target filename
      e:\sales\*.* is source folder name


2. create another batch file ( to decompress and run uha file)

uha.exe x -t"%TEMP%\Soft" -y+ sales.uha
start "" /D"%TEMP%\Soft\Sales" "sales.bat"

************************************************************************************
Regards,

Chittaranjan Satpathy

+919973661801

Saturday, June 18, 2011

Finding the chords of a song

Finding the chords of a song


When I started playing the piano, I had absolutely no clue about chords. Infact, I used to wonder how do people play using both their hands, when I struggle to play with just one. One fine morning, I felt it's about time I learn chords. I was so enthusiastic that I even placed holds on a couple of books in the library that teach you how to play chords in less than a week! Read exhaustively on chords, rhythmic patterns and stuff, only to realise its too much for me. Since I'm just a "bathroom singer" kind of keyboard player :), I thought I'll play chords as and how I like. I sat down for about two days, read some material, the basics I should say and devised a chord-determination algorithm. Surprisingly, it yields good results most of the time. And that's why I decided to share it with my visitors.

Here you go!

Step 1: Identify the notes of the song corresponding to the tune. The song will include only those chords which are combinations of these notes.

Step 2: Analyse the song, line-by-line. Divide each line of the song into logical segments, call each segment a measure. There's more to a measure of a song that what is mentioned here. For simplicity, I'm calling a segment a measure. A measure can typically include 3-6 notes of the tune. Now the question is, where do you set the break points inorder to get measures of a line of song? Here's the simple rule of thumb: Follow your intuition! How I look at it is, I set the breakpoint at the transition of the song from one scale to another. Now, "scale" is yet another technical term like "measure". Pls note that all these terms are used in a very general sense in my context.

Lets take an example. "Yeh mera dil" from Don.

Yeh mera dil pyaar ka deewana
------------ -------- -------
Deewana deewana pyaar ka parvana
------- ------- -------- -------
Aata hai mujhko pyaar mein jaljaana
--------------- ---------- --------
....

Listen to the song keeping an eye on the segmentation above. Sounds right?

I play the first line ("Yeh mera dil pyaar ka deewana") using only three chords. The original song might include many more, but the tune can be contained in three chords. I guess I'm sure of that.

Step 3: Having identified the measures, the next task is to map each measure to a chord. The rule for this is, the chord that correctly maps to the measure should include as many notes of the measure as possible. For instance, look at this:
Yeh mera dil
D E D E C

The chords C and Aminor include both the notes E & C. But how ironical, I play Dminor chord for this measure. An exception in the very beginning! Well, its like this. Generally, the note with which the song begins determines the "scale" of the song. Most of the chords would be centered around this note.

Try playing this measure with C, Aminor and Dminor. You'll see the difference yourself.

Here's what I do. I have this simple chords table which I drafted out.



Step 3.1: Given a measure, using the table above, I identify all possible chords (only major, minor and flat) that include the notes of the measure. I then set the "accompaniment" of my keyboard to ON, and play the notes of the measure with each chord. The chord that perfectly carries the tune of the measure is the one I go with. Somewhat a brute force approach, but for a layman like me, it sure works.

Step 3.2: Once you get a rough idea of the chords for a line (like "yeh mera dil pyaar ka deewana"), play them in sequence without playing the notes. If you can identify the tune by playing just the chords, your chords are right! Otherwise, use your judgement and tweak the chord combination by reconsidering those chords that you've discarded in step 3.1 above.

Repeat steps 3.1 and 3.2 for each line of the song.

Step 4: That's the end of the algorithm!
Powered by intuition, Driven by sharp ears (Quotation courtesy: Infosys :D)

Source :http://sari-gama.blogspot.com/2008/08/finding-chords-of-song.html

Wednesday, May 25, 2011

Corporate Social Responsibility

 " Success is not a Long jump nor a
High jump ,its a Marathon of Steps"
                               A news reporter asked Ratan Tata as to
why Tatas are not making as much money as Reliance. He was said to
have replied, "We are industrialists. They are businessmen.

                                What TATA did to 26/11 Mumbai victims?
                               Pl. do not delete. A must read Topic
for all Indians
                               LET THE WOR LD KNOW WHAT IS
                               "CORPORATE SOCIAL RESPONSIBILITY"?

                               THE NEWS WE DO NOT KNOW! The Tata Gesture
                               1. All category of employees including
those who had completed even 1 day as casuals were treated on duty
during the time the hotel was closed.
                               2. Relief and assistance to all those
who were injured and killed
                               3. The relief and assistance was
extended to all those who died at the railway station, surroundings
including the "Pav- Bha ji" vendor and the pan shop owners.
                               4. During the time the hotel was
closed, the salaries were sent by money order.
                               5. A psychiatric cell was established
in collaboration with Tata Institute of Social Sciences to counsel
those who needed such help.
                               6. The thoughts and anxieties going on
people's mind was constantly tracked and where needed psychological
help provided.
                               7. Employee outreach centers were
opened where all help, food, water, sanitation, first aid and
counseling was provided. 1600 employees were covered by this facility.
                               8. Every employee was assigned to one
mentor and it was that person's responsibility to act as a "single
window" clearance for any help that the person required.
                               9. Ratan Tata personally visited the
families of all the 80 employees who in some manner – either through
injury or getting killed – were affected.
                               10. The dependents of the employees
were flown from outside Mumbai to Mumbai and taken care off in terms
of ensuring mental assurance and peace. They were all accommodated in
Hotel President for 3 weeks.
                               11. Ratan Tata himself asked the
families and dependents – as to what they wanted him to do.
                               12. In a record time of 20 days, a new
trust was created by the Tatas for the purpose of relief of employees.
                               13. What is unique is that even the
other people, the railway employees, the police staff, the pedestrians
who had nothing to do with Tatas were covered by compensation. Each
one of them was provided subsistence allowance of Rs. 10K per month
for all these people for 6 months.
                               14. A 4 year old granddaughter of a
vendor got 4 bullets in her and only one was removed in the Government
hospital. She was taken to Bombay hospital and several lacs were spent
by the Tatas on her to fully recover her.
                               15. New hand carts were provided to
several vendors who lost their carts.
                               16. Tata will take responsibility of
life education of 46 children of the victims of the terror.
                               17. This was the most trying period in
the life of the organization. Senior managers including Ratan Tata
were visiting funeral to funeral over the 3 days that were most
horrible.
                               18. The settlement for every deceased
member ranged from Rs. 36 to 85 lacs [One lakh rupees translates to
approx 2200 US $ ] in addition to the following benefits:
                               a. Full last salary for life for the
family and dependents;
                               b. Complete responsibility of
education of children and dependents – anywhere in the world.
                               c. Full Medical facility for the whole
family and dependents for rest of their life.
                               d. All loans and advances were waived
off – irrespective of the amount.
                               e. Counselor for life for each person
                               B. Epilogue
                               How was such passion created among the
employees? How and why did they behave the way they did?
                               The organization is clear that it is
not something that someone can take credit for. It is not some
training and development that created such behavior. If someone
suggests that – everyone laughs
                               It has to do with the DNA of the
organization, with the way Tata culture exists and above all with the
situation that prevailed that time. The organization has always been
telling that customers and guests are #1 priority
                               The hotel business was started by
Jamshedji Tata when he was insulted in one of the British hotels and
not allowed to stay there.
                               He created several institutions which
later became icons of progress, culture and modernity. IISc is one
such institute. He was told by the rulers that time that he can
acquire land for IISc to the extent he could fence the same. He could
afford fencing only 400 acres.
                               When the HR function hesitatingly made
a very rich proposal to Ratan – he said – do you think we are doing
enough?
                               The whole approach was that the
organization would spend several hundred crore in re-building the
property – why not spend equally on the employees who gave their life?
                               This is NOT COVERED BY Any NEWS CHANNELS
                               Like JOKERS RUNNING AAJTAK, ZEE NEWS ,
IBN These People Busy SHOWING DOGS CATS and cricketers
                               Forward to all people who you know to
show what Ratan Tata DID for his Employees and other Indians.
                               PASS ON TO YOUR FRIENDS! LET THE WOR
LD KNOW WHAT IS "CORPORATE SOCIAL RESPONSIBILITY"?


Friday, May 6, 2011

Create Tally Sale Voucher Export / Purchase Voucher Export

Wednesday, April 20, 2011

Creating Auto Backup using Unirar in dd-mm-yyyy.rar format
==============================================
create a batch file and save it to anyname.bat

@echo off
c:\progra~1\winrar\rar.exe a "c:\%date:~0,2%-%date:~3,2%-%date:~6,4%.rar" c:\temp\*.*
pause

run the batch file in schedule time from task and schedule

Thursday, April 7, 2011

Text to html converter

this is a free chm help file creator which convert text to html free.
Download

Sunday, February 27, 2011

Aarambh hai prachand

Lyrics of Aarambh hai prachand
Album: Gulaal
--------------------------------------------------
Aarambh hai prachand
bole mastakon ke jhuund
aaj jang ki ghadi ki tum guhaar do -2
aan baan shaan yaa ki jaan kaa ho daan
aaj ik dhanuSh ke baan pe utaar do -2
aarambh hai prachand
man kare so praan de
jo man kare so praan le
wahi to ek sarvashaktimaan hai) 2
krishna ki pukaar hai
ye bhaagawat ka saar hai
ki yuddh hi to veer kaa pramaan hai
kauravon ki bhii Dhoya
paandavoon ka nid ho
jo laa sakaa hai wo hii to mahaan hai
jeet kiihawas nahin
kisi pe koii vash nahin
kyaa zindagii hai thokaron pe maar do
maut anth hai nahin
to maut se bhii kyun dare
ye jaake aasamaan mein dahaad do
aarambh hai prachand ...
ho dayaa kaa bhaav
yaa ki shaurya kaa chunav
yaa ki haar ka vo bhaav
tum ye soch lo) 2
ya ki pure bhaal par
jalaa rahe vijay kaa
laal laal ye gulaal
tum ye soch lo
rang kesarii ho ya
mridang kesari ho yaa
ki kesarii ho taal
tum ye soch lo
jis kavi kii kalpanaa mein
zindagi ho prem geet
us kavi ko aaj tum nakaar do
bhigati nasonn mein aaj
phulati ragon mein aaj
aag ki lapat kaa tum baghaar do
aarambh hai prachand

Friday, February 4, 2011

Cheque Printing Software

 
Cheque Printing Software
----------------------------------------
This utility is developed in Vb.net for HDFC BANK cheque printing please contact me

Friday, July 23, 2010

Heart Attacks And Drinking Warm Water




Heart Attacks And Drinking Warm Water



This is a very good article. Not only about the warm water after your meal, but about
Heart Attacks. The Chinese and Japanese drink hot tea with their meals, not cold water, maybe it is time we adopt their drinking habitwhile eating.

For those who like to drink cold water, this article is applicable to you. It is nice to have a cup of cold drink after a meal. However, the cold water will solidify the oily stuff that you have just consumed. It will slow down the digestion. Once this 'sludge' reacts with the acid, it will break down and be absorbed by the intestine faster than the solid food. It will line the intestine. Very soon, this will turn into fats and lead to cancer. It is best to drink hot soup or warm water after a meal.


Common Symptoms Of Heart Attack...

A serious note about heart attacks - You should know that not every heart attack symptom is going to be the left arm hurting
. Be aware of intense pain in the jaw line.

You may never have the first chest pain during the course of a heart attack. Nausea and intense sweating are also common symptoms. 60% of people who have a heart attack while they are asleep do not wake up. Pain in the jaw can wake you from a sound sleep. Let's be careful and be aware. The more we know, the better chance we could survive.

 


 


BENEFITS OF DRUM STICK TREE LEAVES - Murungai Leaves


 

 

 

 

 

BENEFITS OF

DRUM STICK TREE LEAVES - Murungai leaves

                        

                                             

Fun & Info @ Keralites.net

Fun & Info @ Keralites.net

Fun & Info @ Keralites.net

Fun & Info @ Keralites.net

Fun & Info @ Keralites.net

Fun & Info @ Keralites.net

 

Be Healthy and your frendz and family healthier.

 

 






Wednesday, June 16, 2010

Download Hindi Fonts follow the link
Click Here

Wednesday, June 9, 2010

Master Detail programming in Visual Studio 2005 (VB.NET)

Master Detail programming in Visual Studio 2005 (VB.NET)

Start Visual Studio create a new project

Create a database in MS-ACCESS in c:\temp as data.mdb

create following three table


Table Name : PURCH_HDR

INV_NO Number Long Integer primary key
CUSTOMER Number Integer
PDATE Date/Time Date/Time
TOT_AMT Number double

Table Name : PURCH_DTL

IDN Autonumber
INV_NO Number Long Integer
ITEM Number integer
RATE Number double
QTY Number double
AMOUNT Number double

Table Name : Item

ID number integer
ITEM_NAME text
Rate number double

Table Name : customer

ID integer
CustId integer
CustName text
address text

Create the following objects on Form1

Textbox1

Textbox2

Textbox3

Combobox1

DataGridView

Put your controls as follows or you may design as you like because I don’t have good concept on designing form.



Add a bindingnavigator in your form from toolbox


Add three toolstripbutton to your bindingnavigator and name those save, add & delete.



Copy paste the following code to your form code

Imports System.Data.OleDb

Public Class Form1

Friend WithEvents Column1 As System.Windows.Forms.DataGridViewTextBoxColumn

Friend WithEvents Column6 As System.Windows.Forms.DataGridViewTextBoxColumn

Friend WithEvents DataGridViewTextBoxColumn2 As System.Windows.Forms.DataGridViewComboBoxColumn

Friend WithEvents Column3 As System.Windows.Forms.DataGridViewTextBoxColumn

Friend WithEvents Column4 As System.Windows.Forms.DataGridViewTextBoxColumn

Friend WithEvents Column5 As System.Windows.Forms.DataGridViewTextBoxColumn

Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle

Dim BsHeader As New BindingSource

Dim bsDetail As New BindingSource

Dim bsCustomer As New BindingSource

Dim ds As New DataSet

Dim ItemBindingSource As New BindingSource

Dim da As OleDbDataAdapter

Dim da1 As OleDbDataAdapter

Dim da2 As OleDbDataAdapter

Dim dla As New OleDbDataAdapter

Dim dlC As New OleDbDataAdapter

Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\data.mdb")

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

assigngrid()

da = New OleDbDataAdapter("select * from purch_hdr", cn)

Dim da1 As New OleDbDataAdapter("select * from purch_Dtl", cn)

Dim da2 As New OleDbDataAdapter("select * from Item", cn)

Dim dlc As New OleDbDataAdapter("select * from customer", cn)

da.Fill(ds, "Purch_hdr")

da1.Fill(ds, "purch_dtl")

da2.Fill(ds, "Item")

dlc.Fill(ds, "customer")

ds.Relations.Add("MSt_dtl", ds.Tables!purch_hdr.Columns!inv_no, ds.Tables!purch_dtl.Columns!inv_no)

ds.Relations.Add("PURCH_DTL_ITEM", ds.Tables!Item.Columns!ID, ds.Tables!Purch_dtl.Columns!Item)

ds.Relations.Add("Purch_hdr_customer", ds.Tables!customer.Columns!custid, ds.Tables!purch_hdr.Columns!customer)

BsHeader.DataMember = "Purch_hdr"

BsHeader.DataSource = ds

bsDetail.DataMember = "MSt_dtl"

bsDetail.DataSource = BsHeader

ItemBindingSource.DataMember = "Item"

ItemBindingSource.DataSource = ds

bsCustomer.DataMember = "customer"

bsCustomer.DataSource = ds

ComboBox1.DataSource = bsCustomer

ComboBox1.DisplayMember = "CustName"

ComboBox1.ValueMember = "CustId"

'/ data binding to header part

TextBox1.DataBindings.Add("text", BsHeader, "inv_no")

TextBox2.DataBindings.Add("text", BsHeader, "customer")

TextBox3.DataBindings.Add("text", BsHeader, "tot_amt")

ComboBox1.DataBindings.Add("selectedvalue", BsHeader, "customer")

'// binding to detail part

AssignCombo()

DataGridView1.AutoGenerateColumns = False

DataGridView1.DataSource = BsHeader

DataGridView1.DataMember = "MSt_dtl"

Me.DataGridView1.TabIndex = 9

BindingNavigator1.BindingSource = BsHeader

End Sub

Private Sub AssignCombo()

Me.DataGridViewTextBoxColumn2.DataPropertyName = "ITEM"

Me.DataGridViewTextBoxColumn2.DataSource = ItemBindingSource

Me.DataGridViewTextBoxColumn2.DisplayMember = "ITEM_NAME"

Me.DataGridViewTextBoxColumn2.HeaderText = "ITEM NAME"

Me.DataGridViewTextBoxColumn2.Name = "DataGridViewTextBoxColumn2"

Me.DataGridViewTextBoxColumn2.Resizable = System.Windows.Forms.DataGridViewTriState.[True]

Me.DataGridViewTextBoxColumn2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic

Me.DataGridViewTextBoxColumn2.ValueMember = "ID"

End Sub

Private Sub SAVE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE.Click

Try

Me.Validate()

Dim oleparam As New OleDbParameter

da.SelectCommand = New OleDbCommand("select * from purch_hdr")

da.SelectCommand.Connection = cn

da.InsertCommand = New OleDbCommand("insert into purch_hdr ( INV_NO, CUSTOMER, TOT_AMT ) values ( @INV_NO, @CUSTOMER, @TOT_AMT )")

da.InsertCommand.Connection = cn

da.InsertCommand.Parameters.Add("@INV_NO", OleDbType.Integer, 50).Value = Me.TextBox1.Text

da.InsertCommand.Parameters.Add("@CUSTOMER", OleDbType.Integer, 50).Value = Me.ComboBox1.SelectedValue

da.InsertCommand.Parameters.Add("@TOT_AMT", OleDbType.Double, 50).Value = Me.TextBox3.Text

da.UpdateCommand = New OleDbCommand("UPDATE purch_hdr set customer=@CUSTOMER,TOT_AMT = @TOT_AMT WHERE INV_NO = @INV_NO")

da.UpdateCommand.Connection = cn

da.UpdateCommand.Parameters.Add("@CUSTOMER", OleDbType.Integer, 50).Value = Me.ComboBox1.SelectedValue

da.UpdateCommand.Parameters.Add("@TOT_AMT", OleDbType.Double, 50).Value = Me.TextBox3.Text

da.UpdateCommand.Parameters.Add("@INV_NO", OleDbType.Integer, 50).Value = Me.TextBox1.Text

'BsHeader.EndEdit()

da.Fill(ds)

da.Update(ds, "Purch_hdr")

da.SelectCommand = New OleDbCommand("SELECT INV_NO,ITEM, RATE, QTY, AMOUNT FROM PURCH_DTL")

da.SelectCommand.Connection = cn

da.InsertCommand = New OleDbCommand("INSERT INTO PURCH_DTL (INV_NO,ITEM, RATE, QTY, AMOUNT) VALUEs ( @INV_NO,@ITEM, @RATE, @QTY, @AMOUNT)")

da.InsertCommand.Connection = cn

da.InsertCommand.Parameters.Add("@INV_NO", SqlDbType.Int, 4, "INV_NO")

da.InsertCommand.Parameters.Add("@ITEM", SqlDbType.Int, 4, "ITEM")

da.InsertCommand.Parameters.Add("@RATE", SqlDbType.Decimal, 4, "RATE")

da.InsertCommand.Parameters.Add("@QTY", SqlDbType.Decimal, 4, "QTY")

da.InsertCommand.Parameters.Add("@AMOUNT", SqlDbType.Decimal, 4, "AMOUNT")

da.UpdateCommand = New OleDbCommand("UPDATE PURCH_DTL set ITEM=@ITEM, RATE=@RATE, QTY=@QTY, AMOUNT=@AMOUNT WHERE IDN = @IDN")

da.UpdateCommand.Connection = cn

da.UpdateCommand.Parameters.Add("@ITEM", SqlDbType.Int, 4, "ITEM")

da.UpdateCommand.Parameters.Add("@RATE", SqlDbType.Decimal, 4, "RATE")

da.UpdateCommand.Parameters.Add("@QTY", SqlDbType.Decimal, 4, "QTY")

da.UpdateCommand.Parameters.Add("@AMOUNT", SqlDbType.Decimal, 4, "AMOUNT")

da.UpdateCommand.Parameters.Add("@IDN", SqlDbType.Int, 4, "IDN")

BsHeader.EndEdit()

bsDetail.EndEdit()

da.Fill(ds)

da.Update(ds, "Purch_dtl")

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub

Private Sub ADD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ADD.Click

BsHeader.AddNew()

bsDetail.AddNew()

inv_incr()

bsDetail.EndEdit()

BsHeader.EndEdit()

End Sub

Private Sub inv_incr()

Try

If cn.State = ConnectionState.Closed Then

cn.Open()

End If

Dim cmd As New OleDbCommand("select max(inv_no) +1 from purch_hdr", cn)

TextBox1.Text = (cmd.ExecuteScalar())

Catch ex As Exception

TextBox1.Text = 1

End Try

End Sub

Private Sub DELETE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DELETE.Click

Try

If cn.State = ConnectionState.Closed Then

cn.Open()

End If

Dim cmd1 As New OleDbCommand("delete from purch_hdr where inv_no = ?", cn)

cmd1.Parameters.Add("INV_NO", Data.OleDb.OleDbType.Integer, 4).Value = TextBox1.Text

cmd1.ExecuteNonQuery()

Dim cmd2 As New OleDbCommand("delete from purch_DTL where inv_no = ?", cn)

cmd2.Parameters.Add("INV_NO", Data.OleDb.OleDbType.Integer, 4).Value = TextBox1.Text

cmd2.ExecuteNonQuery()

BsHeader.RemoveCurrent()

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub

Private Sub calc_me()

DataGridView1.CurrentRow.Cells(5).Value = (DataGridView1.CurrentRow.Cells(4).Value * DataGridView1.CurrentRow.Cells(3).Value)

End Sub

Private Sub DataGridView1_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit

If e.ColumnIndex = 2 Then

DataGridView1.CurrentRow.Cells(3).Value = ds.Tables!item.Rows(ItemBindingSource.Position)!Rate.ToString

End If

If DataGridView1.Columns(e.ColumnIndex).Name = "Column3" Or DataGridView1.Columns(e.ColumnIndex).Name = "Column4" Or DataGridView1.Columns(e.ColumnIndex).Name = "Column5" Then

' calc_me()

End If

End Sub

Private Sub DataGridView1_CellValidated(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellValidated

Try

Dim sum As Int32 = 0

For Each r As DataGridViewRow In Me.DataGridView1.Rows

'sum = sum + r.Cells(3).Value * r.Cells(4).Value

r.Cells(5).Value = r.Cells(3).Value * r.Cells(4).Value

Next

Catch ex As Exception

End Try

End Sub

Sub assigngrid()

Me.Column1 = New System.Windows.Forms.DataGridViewTextBoxColumn

Me.Column6 = New System.Windows.Forms.DataGridViewTextBoxColumn

Me.DataGridViewTextBoxColumn2 = New System.Windows.Forms.DataGridViewComboBoxColumn

Me.Column3 = New System.Windows.Forms.DataGridViewTextBoxColumn

Me.Column4 = New System.Windows.Forms.DataGridViewTextBoxColumn

Me.Column5 = New System.Windows.Forms.DataGridViewTextBoxColumn

Me.DataGridView1.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Column1, Column6, DataGridViewTextBoxColumn2, Column3, Column4, Column5})

'Column1

'

Me.Column1.DataPropertyName = "IDN"

Me.Column1.HeaderText = "IDN"

Me.Column1.Name = "Column1"

'

'Column6

'

Me.Column6.DataPropertyName = "INV_NO"

Me.Column6.HeaderText = "INV_NO"

Me.Column6.Name = "Column6"

Me.Column6.Visible = False

'

'DataGridViewTextBoxColumn2

'

Me.DataGridViewTextBoxColumn2.HeaderText = "DATA"

Me.DataGridViewTextBoxColumn2.Name = "DataGridViewTextBoxColumn2"

Me.DataGridViewTextBoxColumn2.Resizable = System.Windows.Forms.DataGridViewTriState.[True]

Me.DataGridViewTextBoxColumn2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic

'

'Column3

'

Me.Column3.DataPropertyName = "RATE"

Me.Column3.HeaderText = "RATE"

Me.Column3.Name = "Column3"

'

'Column4

'

Me.Column4.DataPropertyName = "QTY"

Me.Column4.HeaderText = "QTY"

Me.Column4.Name = "Column4"

'

'Column5

'

Me.Column5.DataPropertyName = "AMOUNT"

DataGridViewCellStyle2.Format = "N2"

DataGridViewCellStyle2.NullValue = Nothing

Me.Column5.DefaultCellStyle = DataGridViewCellStyle2

Me.Column5.HeaderText = "AMOUNT"

Me.Column5.Name = "Column5"

End Sub

End Class

Run the project & enjoy.


Download complete source code Click Here