Click here to Skip to main content
15,891,431 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionProblem regarding datagrid viewbutton column Pin
Member 1019283531-Oct-13 0:54
Member 1019283531-Oct-13 0:54 
QuestionRe: Problem regarding datagrid viewbutton column Pin
Eddy Vluggen31-Oct-13 8:15
professionalEddy Vluggen31-Oct-13 8:15 
Questioneror ,operator' = 'is not defined for system.windows.forms.datagridviewcolumn and system.windows.forms.datagridviewbuttoncolumn Pin
Member 1019283530-Oct-13 1:22
Member 1019283530-Oct-13 1:22 
AnswerRe: eror ,operator' = 'is not defined for system.windows.forms.datagridviewcolumn and system.windows.forms.datagridviewbuttoncolumn Pin
Richard MacCutchan30-Oct-13 2:04
mveRichard MacCutchan30-Oct-13 2:04 
GeneralRe: eror ,operator' = 'is not defined for system.windows.forms.datagridviewcolumn and system.windows.forms.datagridviewbuttoncolumn Pin
Member 1019283530-Oct-13 20:41
Member 1019283530-Oct-13 20:41 
SuggestionRe: eror ,operator' = 'is not defined for system.windows.forms.datagridviewcolumn and system.windows.forms.datagridviewbuttoncolumn Pin
Richard MacCutchan30-Oct-13 22:00
mveRichard MacCutchan30-Oct-13 22:00 
AnswerRe: eror ,operator' = 'is not defined for system.windows.forms.datagridviewcolumn and system.windows.forms.datagridviewbuttoncolumn Pin
TnTinMn31-Oct-13 9:27
TnTinMn31-Oct-13 9:27 
GeneralRe: eror ,operator' = 'is not defined for system.windows.forms.datagridviewcolumn and system.windows.forms.datagridviewbuttoncolumn Pin
Member 101928351-Nov-13 21:11
Member 101928351-Nov-13 21:11 
Dear Sir,

First of all,Thank you so much for your kind endevour to make the code right, it's working when i click on the edit button the selected record shows in the text box and clicking on the delete button it' working properly, but one thing is here , I change my code as you send to me but when I update the record and click on save button , the new record is added with update text box not updated the existing record, I am sending following my save button click event,

VB
Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click
       If validateform() Then
           If id IsNot Nothing Then

               Dim result As Boolean = lbll.updatelorry(txtLcode.Text.Trim(), txtLno.Text.Trim(), txtDname.Text.Trim())
               If result = True Then
                   ClearText()
                   bindgrid()
                   id = Nothing
                   MessageBox.Show("Update Successfully")

               End If
           Else
               Dim result As Boolean = lbll.insertlorry(txtLcode.Text.Trim(), txtLno.Text.Trim(), txtDname.Text.Trim())
               If result = True Then
                   ClearText()
                   bindgrid()
                   MessageBox.Show("Created Successfully")
               End If
           End If
       End If
   End Sub


I have changed the "idstring" to id" which is used by you in my whole coding.one thing is there that in save button click event I have written that (if id isNoting) then proceed the update command. At this stage I already added the code "if id =0" cause he editbutton.index is 0, but it's not working throw message i.e
The method or operation is not implemented.
where as I am using the Function update.which is below

VB
Public Function updatelorry(ByVal pkId As Integer, ByVal Lcode As String, ByVal Lno As String, ByVal Dname As String) As Boolean
            Try
                Dim param As SqlParameter() = New SqlParameter(3) {}
                param(0) = New SqlParameter("@pkid", pkId)
                param(1) = New SqlParameter("@lcode", Lcode)
                param(2) = New SqlParameter("@lno", Lno)
                param(3) = New SqlParameter("@dname", Dname)
                SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, "updatelorry", param)
                Return True
            Catch
                Throw
            End Try
        End Function

also it makes automatic another update function where the message throws which is below
VB
Function updatelorry(ByVal p1 As String, ByVal p2 As String, ByVal p3 As String) As Boolean
           Throw New NotImplementedException--error shows here

       End Function


when i use in save button click event that
if id=editbutton.index then the same message throw.

Please suggest me what to do at this stage to make the update procedure active.

also if i use comment in the automatic created function then it shows another error is that
"Argument not specified for parameter 'Dname' of 'Public Function updatelorry(pkId As Integer, Lcode As String, Lno As String, Dname As String) As Boolean'.at save button click event

VB
Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click
       If validateform() Then
           'If id IsNot Nothing Then
           If id = editbutton.Index Then

               Dim result As Boolean = lbll.updatelorry(txtLcode.Text.Trim(), txtLno.Text.Trim(), txtDname.Text.Trim())--Error Shows here
               If result = True Then
                   ClearText()
                   bindgrid()
                   id = Nothing
                   MessageBox.Show("Update Successfully")

               End If
           Else
               Dim result As Boolean = lbll.insertlorry(txtLcode.Text.Trim(), txtLno.Text.Trim(), txtDname.Text.Trim())
               If result = True Then
                   ClearText()
                   bindgrid()
                   MessageBox.Show("Created Successfully")
               End If
           End If
       End If
   End Sub


the stored procedure od update command is

ALTER PROCEDURE [dbo].[updatelorry]
@lcode varchar(50),
@lno varchar(50),
@dname varchar(50),
@pkId int
AS
BEGIN
	update lorrymaster set LCode=@lcode,Lno=@lno,Dname=@dname
	where pkid=@pkId
	select  @pkId
END


Also the lorrymaster table structure is

SQL
CREATE TABLE [dbo].[lorrymaster](
    [pkid] [int] IDENTITY(1,1) NOT NULL,
    [lcode] [varchar](50) NULL,
    [lno] [varchar](50) NULL,
    [dname] [varchar](50) NULL,
    [createdate] [smalldatetime] NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

Questionproblem not solved Pin
coolerfantasy29-Oct-13 19:31
coolerfantasy29-Oct-13 19:31 
AnswerRe: problem not solved Pin
Richard MacCutchan30-Oct-13 2:07
mveRichard MacCutchan30-Oct-13 2:07 
AnswerRe: problem not solved Pin
Dave Kreskowiak30-Oct-13 2:32
mveDave Kreskowiak30-Oct-13 2:32 
AnswerRe: problem not solved Pin
Vaclav_3-Nov-13 14:36
Vaclav_3-Nov-13 14:36 
QuestionCheckPIDDll Pin
Member 1027776329-Oct-13 9:34
Member 1027776329-Oct-13 9:34 
AnswerRe: CheckPIDDll Pin
Dave Kreskowiak29-Oct-13 10:27
mveDave Kreskowiak29-Oct-13 10:27 
QuestionProblem in opening forms Pin
SPSandy27-Oct-13 7:43
SPSandy27-Oct-13 7:43 
AnswerRe: Problem in opening forms Pin
Dave Kreskowiak27-Oct-13 10:20
mveDave Kreskowiak27-Oct-13 10:20 
AnswerRe: Problem in opening forms Pin
Chaim Tovim13-Nov-13 1:24
Chaim Tovim13-Nov-13 1:24 
QuestionLAN Port Controlling Relay Pin
coolerfantasy26-Oct-13 21:45
coolerfantasy26-Oct-13 21:45 
AnswerRe: LAN Port Controlling Relay Pin
Jonathan Davies27-Oct-13 2:13
Jonathan Davies27-Oct-13 2:13 
AnswerRe: LAN Port Controlling Relay Pin
Dave Kreskowiak27-Oct-13 5:31
mveDave Kreskowiak27-Oct-13 5:31 
AnswerRe: LAN Port Controlling Relay Pin
coolerfantasy27-Oct-13 19:37
coolerfantasy27-Oct-13 19:37 
GeneralRe: LAN Port Controlling Relay Pin
Richard MacCutchan27-Oct-13 22:52
mveRichard MacCutchan27-Oct-13 22:52 
GeneralRe: LAN Port Controlling Relay Pin
Dave Kreskowiak28-Oct-13 1:40
mveDave Kreskowiak28-Oct-13 1:40 
GeneralRe: LAN Port Controlling Relay Pin
coolerfantasy28-Oct-13 19:51
coolerfantasy28-Oct-13 19:51 
GeneralRe: LAN Port Controlling Relay Pin
Dave Kreskowiak29-Oct-13 1:54
mveDave Kreskowiak29-Oct-13 1:54 

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.