Click here to Skip to main content
16,014,860 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: updating database in vb.net Pin
parkash_C27-Feb-09 0:44
parkash_C27-Feb-09 0:44 
GeneralRe: updating database in vb.net Pin
Vimalsoft(Pty) Ltd27-Feb-09 0:51
professionalVimalsoft(Pty) Ltd27-Feb-09 0:51 
Question[Message Deleted] Pin
computer_WHIZ17-Feb-09 23:21
computer_WHIZ17-Feb-09 23:21 
AnswerRe: what is the code in making a 3 x 3 picture puzzle? Pin
Steven J Jowett17-Feb-09 23:34
Steven J Jowett17-Feb-09 23:34 
GeneralRe: what is the code in making a 3 x 3 picture puzzle? Pin
computer_WHIZ17-Feb-09 23:59
computer_WHIZ17-Feb-09 23:59 
AnswerRe: what is the code in making a 3 x 3 picture puzzle? Pin
Ashfield18-Feb-09 1:32
Ashfield18-Feb-09 1:32 
AnswerRe: what is the code in making a 3 x 3 picture puzzle? Pin
Dave Kreskowiak18-Feb-09 2:17
mveDave Kreskowiak18-Feb-09 2:17 
Questionmove reports form a datagridview to another Pin
lordgara17-Feb-09 23:05
lordgara17-Feb-09 23:05 
Hi, I'm using ado.net to connect to an access database. There are 2 tables "Collezione", bound to dgv1, and "Mazzo", bound to dgv2.
I have a problem with a button (see below for the code) that take a row from dgv1 and copy it in the dataset2 (das2) that is linked to dgv2. When the datarow that I want to copy it's just present in dataset2 I must increase the value in the quantity field in da2 without copy the row.

The code works, but when I copy the 3th different row it stops. Same thing when I try to increase the amount of the second row that I moved :S

Where I'm wrong? Thanks for help!

Here's the code of the button:

Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click

Dim dr As DataRow
dr = das2.Tables("Mazzo").NewRow()

'copy the data from dgv1 to a datarow
Dim i, indexRiga1, colonne1, righeDas2 As Integer
colonne1 = dgv1.ColumnCount - 1
indexRiga1 = dgv1.CurrentRow.Index
If dgv1.SelectedRows.Count > 0 Then
For i = 0 To colonne1
dr(i) = dgv1.Item(i, indexRiga1).Value
Next
dr(11) = 1 'it's the amount index
End If

'if dataSet2 is empty, add the row
righeDas2 = das2.Tables("Mazzo").Rows.Count - 1
If righeDas2 < 0 Then
das2.Tables("Mazzo").Rows.Add(dr)
End If

'if dataSet2 is not empy, try to find if datarow is just present
For i = 0 To righeDas2
If das2.Tables("Mazzo").Rows(i).Item("Nome") = dr(1) And _
das2.Tables("Mazzo").Rows(i).Item("Col") = dr(5) And _
das2.Tables("Mazzo").Rows(i).Item("Tipo") = dr(6) Then

dr(11) = das2.Tables("Mazzo").Rows(i).Item("Giocate") + 1 'increase the amount
das2.Tables("Mazzo").Rows(i).Delete()
das2.Tables("Mazzo").Rows.Add(dr)

End If
Else
das2.Tables("Mazzo").Rows.Add(dr)
End If
Next

End Sub

AnswerRe: move reports form a datagridview to another Pin
Dave Kreskowiak18-Feb-09 4:43
mveDave Kreskowiak18-Feb-09 4:43 
GeneralRe: move reports form a datagridview to another Pin
lordgara18-Feb-09 5:21
lordgara18-Feb-09 5:21 
QuestionVB.NET Pin
Umesh_8617-Feb-09 20:22
Umesh_8617-Feb-09 20:22 
AnswerRe: VB.NET Pin
Vimalsoft(Pty) Ltd17-Feb-09 21:51
professionalVimalsoft(Pty) Ltd17-Feb-09 21:51 
QuestionNeed Autocomplete Textbox With Text and Value Property Pin
Jagz W17-Feb-09 19:17
professionalJagz W17-Feb-09 19:17 
AnswerRe: Need Autocomplete Textbox With Text and Value Property Pin
dan!sh 17-Feb-09 20:17
professional dan!sh 17-Feb-09 20:17 
QuestionGet Pen Drive Serial No. Not Drive No Pin
Vikash Yadav17-Feb-09 18:56
Vikash Yadav17-Feb-09 18:56 
Questionvb2008 doesn't call a sub in a form Called through assembly Pin
Aiman Farouk Mohamed17-Feb-09 18:46
Aiman Farouk Mohamed17-Feb-09 18:46 
AnswerRe: vb2008 doesn't call a sub in a form Called through assembly Pin
kvelu.d17-Feb-09 19:22
kvelu.d17-Feb-09 19:22 
GeneralRe: vb2008 doesn't call a sub in a form Called through assembly Pin
Aiman Farouk Mohamed18-Feb-09 0:30
Aiman Farouk Mohamed18-Feb-09 0:30 
QuestionCreate setup project using own code Pin
kvelu.d17-Feb-09 17:58
kvelu.d17-Feb-09 17:58 
AnswerRe: Create setup project using own code Pin
Dave Kreskowiak17-Feb-09 18:02
mveDave Kreskowiak17-Feb-09 18:02 
GeneralRe: Create setup project using own code Pin
kvelu.d17-Feb-09 18:12
kvelu.d17-Feb-09 18:12 
GeneralRe: Create setup project using own code Pin
Vimalsoft(Pty) Ltd17-Feb-09 21:54
professionalVimalsoft(Pty) Ltd17-Feb-09 21:54 
GeneralRe: Create setup project using own code Pin
Dave Kreskowiak18-Feb-09 1:35
mveDave Kreskowiak18-Feb-09 1:35 
GeneralRe: Create setup project using own code Pin
Vimalsoft(Pty) Ltd17-Feb-09 21:56
professionalVimalsoft(Pty) Ltd17-Feb-09 21:56 
GeneralRe: Create setup project using own code Pin
Dave Kreskowiak18-Feb-09 1:34
mveDave Kreskowiak18-Feb-09 1:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.