|
Dear Sir,
I am facing still the problem regarding the editbuttoncolumn
when i click on the edit button and modify the record the control goes to "Created successfully, not updated the record just insert the new record with modifying field.
Regards
Anand.
|
|
|
|
|
If this relates to a previous question then please provide the details, or at least a link to that question.
Veni, vidi, abiit domum
|
|
|
|
|
|
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,
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
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
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
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
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
|
|
|
|
|
Just some suggestions and observations. You may want to look at this tip[^] I use 1 proc to do both jobs so the UI/BL does not give a rats whether the record is new or not.
Try using CamelCase in your naming convention.
Try naming you ID field more sensibly, I recommend TableNameID so LorryMasterID
Try naming your fields better, you are not restricted by length dname => DriverName
Beyond the tip linked to I now return the RECORD just inserted/updated by the stored proc. This requires a gettable type call to the database instead of executescalar but you get the ID value back to you client (This may be the root cause of your current problem)
Beyond the above extension of a tip I would recommend building views to support any FK fields so the insert/update should return the VIEW of the LorryMaseter record just inserted/updated.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanx, but one thing is here , i used all my effort but don't know where is the problem
|
|
|
|
|
Now that GetVersionEx is deprecated (starting windows 8.1) and will only ever tell me that my program is running on windows 6.2 build 9200
has anyone found a way to work out when I am on windows 8.1 from within VB6?
converting to .net is not an option (certainly not a quick or easy one) and the only examples I have been able to find are all c++
I thought I would ask before I sink to the level of trying to scrape the output from a cmd window
|
|
|
|
|
Good luck with that.
I was going to post something disparaging organisations that are still using VB6 code but I guess you already know that!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks for your support, I shall wear it always (joking)
hideous but, for anyone else caught in the same trap
shell "cmd /c ver > fred.txt"
and then read fred.txt
I know crude, horrible but what would you expect from someone that programs in VB6
At least you will all feel totally righteous when Microsoft finally stops supporting the runtime and sit around saying "I told them but would they listen"
|
|
|
|
|
I'm currently working in Silverlight so have premonitions of the hassle you are going through. However we are already looking at moving to MVC which I personally don't like.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Actually we should ask Microsoft to stop their "extended" support for old systems far earlier than they do now. That is perhaps the only basis on we can convince our bosses to stop our support for those old systems... (I am happy that we got rid of Windows 2000 last year!)
|
|
|
|
|
Just a guess. But, how about reading the registry?
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentBuild
|
|
|
|
|
lucky guess that
and maybe a tad more elegant
Thank you
|
|
|
|
|
|
Well that was a deep an meaningful posting, if you want to just be friendly wander over to the Lounge, this forum is for coding issues.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Be patient it's written in Java - the "World" part is still to come...
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
That was better than most of the jokes in the SB
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi guys,
so I am new to VB.NET and am still trying to wrap my head around MVVM. I think it is a great way of designing an application; however, all I am able to track down on the web are C$ examples and only very little "Over my head" info given in vb.net. Unfortunately I don't have enough time to learn C$ so applying mvvm to vb.net proves difficult at best.
Here is my diellema and please bear with me here if this isn't the correct way of doing things, I am just trying to learn. I have a datatable that I eventually want to show on multiple gridviews in multiple windows.
I created a class called "DataModel"
Imports System.Data
Imports System.ComponentModel
Public Class DataModel
Implements INotifyPropertyChanged
Private _testDataView As New DataView
Public Property TestDataView() As DataView
Get
Return _testDataView
End Get
Set(value As DataView)
_testDataView = value
InvokePropertyChanged("TestDataView")
End Set
End Property
Public Sub InvokePropertyChanged(Properties As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(Properties))
End Sub
Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
End Class
and I am currently adding data at the Application Startup in Application.XAML.vb
Imports System.Data
Class Application
Private Sub Application_Startup(sender As Object, e As StartupEventArgs) Handles Me.Startup
Dim dataTableView As DataModel
Dim dataTable As DataTable
dataTable.Columns.Add("DeptID", GetType(System.Int32))
dataTable.Columns.Add("DepartmentName", GetType(System.String))
dataTable.Columns.Add("HOD", GetType(System.String))
dataTable.Columns.Add("FacultyCount", GetType(System.String))
Dim row As DataRow = dataTable.NewRow()
row("DeptID") = 1
row("DepartmentName") = "CS&E"
row("HOD") = "John"
row("FacultyCount") = 20
dataTable.Rows.Add(row)
row = dataTable.NewRow()
row("DeptID") = 2
row("DepartmentName") = "Mech"
row("HOD") = "Bo Yo"
row("FacultyCount") = 23
dataTable.Rows.Add(row)
dataTableView.TestDataView = dataTable.DefaultView
End Sub
End Class
Here is the MainWindow.xaml (I only created a datagrid to display the datatable and set the datacontext of the window to the class DataModel)
<Window x:Class="MainWindow"
DataContext="DataModel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="41*"/>
<ColumnDefinition Width="6*"/>
</Grid.ColumnDefinitions>
<DataGrid ItemsSource="{Binding TestDataView}" HorizontalAlignment="Left" Height="273" Margin="10,25,0,0" VerticalAlignment="Top" Width="480" Grid.ColumnSpan="2" />
</Grid>
</Window>
The problem is, there are no errors but I can't see any values in my datagrid. I really don't know what I am doing wrong here. Would any of you guys be willing to help me out? Thank you very much in advance
|
|
|
|
|
You did not try hard enough, try searching VB MVVM here and you will see that there are a number of VB articles, true some will be in c#.
There are so many fundamental design errors in the sample that you need to do some reading on what MVVM pattern is designed to achieve.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am currently making a web browser in Visual Basic 2010 express and I am using the latest version of the Awesomium browser engine. I have put a lot of time and effort into this browser and would like for it to have an ad blocker. I have seen many browsers in VB have an ad blocker but I have never been able to get the source code for one. What would be the best way to go about this?
|
|
|
|
|
AdvantageSoft wrote: What would be the best way to go about this? ..you'd need a blacklist of URL's to block. When the browser makes a request for a domain from the blacklist, you refuse to fetch it.
Does awesomium have an event that's thrown before it fetches something from the web?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
You could go with the nuclear option and use the Hosts file.[^]
This site [^] has a modified Hosts file that lists many problem addresses.
If you don't use this option, the file is still a good starting point for a list of blacklisted sites that Eddy has mentioned.
|
|
|
|
|
you can use the silent to avoide ads
|
|
|
|
|
Dear Sir
i made a datagrid and two button column by using New datagridveiwbuttoncolumn, "Edit" and "X"
I want that when i click on edit button then the selected record displayed in the text box, but the click event is not working in the ode. following is the code:
Private Sub dgvLorryMaster_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvLorryMaster.CellClick
Try
If e.RowIndex >= 0 AndAlso e.ColumnIndex = dgvLorryMaster.Columns("Edit").Index Then
Displaylorry(Convert.ToInt32(idString))
End If
If e.RowIndex <> 0 AndAlso e.ColumnIndex = dgvLorryMaster.Columns("X").Index Then
Dim num As DialogResult = MessageBox.Show("Are you want to delete the record !!!.", "", MessageBoxButtons.YesNo)
If num = DialogResult.Yes Then
Dim result As Boolean = lbll.deletelorry(Convert.ToInt32(idString))
If result = True Then
ClearText()
MessageBox.Show("Deleted Successfully")
bindgrid()
End If
Else
ClearText()
End If
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
the error comes "null exception handles"
please suggest me what should ido for generate click event
thanx
|
|
|
|
|
Member 10192835 wrote: the error comes "null exception handles" Please, copy/paste the exact message. And at which line is it throwing that exception?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|