Community Member
Member Avatar
Topic by Jayanta_1 in Software Development
@Shark `purinvid` seems to be the table's key, so if it does not exist `result`will be 0 out from `executeScalar`and the row will be added. In the other case the row will be updated. Reply by xrj
Member Avatar
xrj 124 Replied To a Post in User Login Codes using VB and Access..
Topic by tomexlfc in Software Development
Of course I suppose the student data has been entered correctly, but I can't see the need for entering a third field: status. If you want to assure the password you may constrain passwords to those containing both capital and lower letters and special characters like !,$,%, and so on. … Reply by xrj
Member Avatar
Hello,

I wrote some codes for student login. the codes checks for the "username", "password" as well as their type of "status", from the database. once this input are met, the student logs in successful, otherwise a message pops up.

The problem i encountered is this, i have 11 student … Topic by tomexlfc in Software Development
Member Avatar
Featured xrj 124 Replied To a Post in Is it possible to get the source path
Topic by Mr.M in Software Development
More specifically you need a [File System MiniFilter](https://docs.microsoft.com/es-es/windows-hardware/drivers/ifs/file-system-minifilter-drivers) which is far less complicated -although still complicated. It has a function or routine [FltGetFileNameInformation](https://msdn.microsoft.com/en-us/library/windows/hardware/ff543032(v=vs.85).aspx) (also [FltGetFileNameInformationUnsafe](https://msdn.microsoft.com/en-us/library/windows/hardware/ff543035(v=vs.85).aspx) to retrieve the file name. Reply by xrj
Member Avatar
Topic by Jayanta_1 in Software Development
The code had severall errors. Maybe this other way you can make it work:

Dim sql = "select Count(*) from pur_invdet where purinvid=@purinvid"
Dim cmd = New OleDb.OleDbCommand(sql, cn)
cmd.Parameters.AddWithValue("@purinvid", TextBox1.Text)
Dim result As Integer = Convert.ToInt32(cmd.ExecuteScalar())
cmd.Parameters.Clear()

Try
If result > 0 Then

For Each x As ListViewItem In … Reply by xrj
Member Avatar
Topic by Jayanta_1 in Software Development
You are setting just one parameter in the Update statement while adding later 3 parameters. Can't you include the execute `cmd.executeNonQuery`s inside a try - catch to see if there is any error message? Reply by xrj
Member Avatar
Topic by Jayanta_1 in Software Development
Change lines #21 and 22 into the following to see how many registers are really updated:

dim n as int32 = cmd.ExecuteNonQuery() 'n=The number of rows affected'
MsgBox("Updated "+n.tostring+" rows")

Change lines #30 and 31 into the following and see how many registers are really saved:

dim n as int32= … Reply by xrj
Member Avatar
I use the this code. showing "Update" msg but not update and if i add an item then show "Update" not "save"
Please help me.....


Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
Dim sql = "select Count(*) from pur_invdet where purinvid= txtpurinvid.text"
Dim cmd = … Topic by Jayanta_1 in Software Development
Member Avatar
xrj 124 Replied To a Post in Cant print using PrinttoPrinter command
Topic by Programmer_2 in Software Development
Searching seems as there is an issue in CrystalReports. Can't you divide, as a workaround, the report in two or three so each one has less than 2^15=32768 pages? Reply by xrj
Member Avatar
Cant print crystal report viewers records after 32767 page ... im using crystalreportviewer.printtoprinter command Topic by Programmer_2 in Software Development
Member Avatar
Topic by Jayanta_1 in Software Development
Thanks to you again for your confidence. Reply by xrj
Member Avatar
Topic by Jayanta_1 in Software Development
Well, both tables must be read. You may code something like:

Public Sub Displayitem()

Dim cmd As New OleDb.OleDbCommand("SELECT * FROM pur_inv,inv_type WHERE pur_inv.invtypid=inv_type.invtypid ORDER BY purinvdt", cn)
Dim dr As OleDb.OleDbDataReader = cmd.ExecuteReader()

ListView1.Items.Clear()
Do While dr.Read()
Dim new_item As New _
ListViewItem(dr.Item("purinvdt").ToString)
new_item.SubItems.Add(dr.Item("purinvid").ToString)
new_item.SubItems.Add(dr.Item("prtid").ToString)

new_item.SubItems.Add(dr.Item("pur_inv.invtypid").ToString)
new_item.SubItems.Add(dr.Item("taxamt").ToString)
new_item.SubItems.Add(dr.Item("tottaxblamt").ToString)
new_item.SubItems.Add(dr.Item("invamt").ToString) … Reply by xrj
Member Avatar
Topic by Jayanta_1 in Software Development
Then change invtypid by invtyp:

Public Sub Displayitem()
ListView1.Items.Clear()
Dim cmd As New OleDb.OleDbCommand("SELECT * FROM pur_inv ORDER BY purinvdt", cn)
Dim dr As OleDb.OleDbDataReader = cmd.ExecuteReader()

Do While dr.Read()
Dim new_item As New _
ListViewItem(dr.Item("purinvdt").ToString)
new_item.SubItems.Add(dr.Item("purinvid").ToString)
new_item.SubItems.Add(dr.Item("prtid").ToString)

new_item.SubItems.Add(dr.Item("invtyp").ToString)
new_item.SubItems.Add(dr.Item("taxamt").ToString)
new_item.SubItems.Add(dr.Item("tottaxblamt").ToString)
new_item.SubItems.Add(dr.Item("invamt").ToString)
ListView1.Items.Add(new_item)
Loop
End Sub Reply by xrj
Member Avatar
Topic by Jayanta_1 in Software Development
Of course, if not present, you should add a reference to `System.Linq`. Reply by xrj
Member Avatar
Topic by Jayanta_1 in Software Development
If you mean to select a concrete id, you could do the following. When `invtypid` is -1, all the ids will be shown (on load event); when > -1 that only id will be shown (when button is clicked):

Public Sub Displayitem(Optional invtypid As Int32 = -1)

Dim da As … Reply by xrj
Member Avatar
Topic by Jayanta_1 in Software Development
I can't see anything wrong with the code you are sharing. So, what's the problem? Can you explain a bit further? Reply by xrj
Member Avatar
Hello
Teachers
I create a project in vb.net 2010 with access database. I want to show data in listview. It Is show in listview but a problem I entry **Id wise**. So, when I click on the show data button I see the **Id** . How to show the id … Topic by Jayanta_1 in Software Development
Member Avatar
Featured xrj 124 Replied To a Post in Is it possible to get the source path
Topic by Mr.M in Software Development
Just a file system filter driver [Here](https://docs.microsoft.com/en-us/windows-hardware/drivers/ifs/file-system-filter-drivers) would do the job. Reply by xrj
Member Avatar
Featured xrj 124 Began Watching Is it possible to get the source path
Hi DW.

I would like to know if its possible to get the source path of a file copied/moved to a folder I set a FileSystemWatcher? What I mean is that get the location as to where this file is coming from if its was copied/moved into this folder.

Thank … Topic by Mr.M in Software Development
Member Avatar
xrj 124 Replied To a Post in VB.NET - TCP IMAGE TRANSFER
Topic by Luke_7 in Software Development
You may send the image as plain text [Click Here](https://social.msdn.microsoft.com/Forums/vstudio/en-US/b0da124b-976b-4502-b38d-e33ad845be6b/how-to-save-images-to-text-file-as-charactersbinary-or-whatever-and-retrieve-them-back-to-picture?forum=vbgeneral) Reply by xrj
Member Avatar
xrj 124 Began Watching VB.NET - TCP IMAGE TRANSFER
hi im having some trouble transfering images over tcp. i currently have a function set up to transfer text but would like to know how i would do this for images.
thanks in advance. Topic by Luke_7 in Software Development
Member Avatar
Topic by Jayanta_1 in Software Development
Thank you for your confidence. Reply by xrj
Member Avatar
Topic by Jayanta_1 in Software Development
Sorry, I thought your code was for WPF. So, it should be:

Public Sub listView1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles ListView1.KeyDown
If e.Modifiers = Keys.Alt AndAlso _
e.KeyCode = Keys.Delete Then
If ListView1.SelectedItems.Count Then
Dim item As ListViewItem = ListView1.SelectedItems(0)
ListView1.Items.Remove(item)
e.Handled = True
End If
End If
End … Reply by xrj
Member Avatar
Topic by Jayanta_1 in Software Development
I would code this way:

Public Sub listView1_KeyDown(sender As Object, e As System.Windows.Input.KeyEventArgs) Handles ListView1.KeyDown
If e.Key = Key.System AndAlso _
e.SystemKey = Key.Delete Then
If ListView1.SelectedItems.Count Then
Dim item As ListViewItem = ListView1.SelectedItems(0)
ListView1.Items.Remove(item)
e.Handled = True
End If
End If
End Sub Reply by xrj
Member Avatar
Topic by Jayanta_1 in Software Development
Are you talking about a ListView, a container of images? Or perhaps are you refering to a listbox filled with items? Reply by xrj
Member Avatar
how can I use Alt+Del to Delete listview item ...
Now I just select the row and press del key delete the item, But I want to delete item by press alt+del key. How it is possible Please help me....


What I have tried:


Private Sub ListView1_KeyDown(ByVal sender As Object, … Topic by Jayanta_1 in Software Development
Member Avatar
Topic by Tim_8 in Software Development
For example:

Enum mouseDwn
none = 0
srcIsNum1
srcIsNum2
End Enum
Dim IsMouseDown As mouseDwn = mouseDwn.none
Private Sub DataGridView1_CellMouseDown(sender As Object, e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseDown
IsMouseDown = mouseDwn.srcIsNum1
End Sub
Private Sub DataGridView2_CellMouseDown(sender As Object, e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView2.CellMouseDown
IsMouseDown = mouseDwn.srcIsNum2
End Sub
Private Sub DataGridView2_CellMouseMove(sender … Reply by xrj
Member Avatar
Topic by Tim_8 in Software Development
On the mouse down event for each source, while initiating the drag, you may set a flag `IsMouseDown` with a value indicating which is the source. If the mouse down event occurs in let's say DataGridView1, then set `IsMouseDown=srcIsNum1`. In case the dragging starts with a mouse down event on … Reply by xrj
Member Avatar
Topic by Rica_1 in Software Development
If product names are really the same in both datagridview, i.e., no need to add rows:

Dim us As New Globalization.CultureInfo("en-US")
Function parseN(value As String, ByRef result As Double) As Boolean
Return Double.TryParse(value, Globalization.NumberStyles.Any, us, result)
End Function

Private Sub btnCopyLeftToRight_Click(sender As System.Object, e As System.EventArgs) Handles btnCopyLeftToRight.Click
CopyDGV(DataGridViewLeft, DataGridViewRight) … Reply by xrj
Member Avatar
Hi Maam and Sir.
I need your expertise on vb.net.
I have two data grid with database on their own. I want to copy/update the data from one database to another.
The data grid have product codes and prices. I want to copy/update only the prices from the first data … Topic by Rica_1 in Software Development