|
Imports System.Data
Imports System.Data.OracleClient
Public Class POSfrm
Dim lst As ListViewItem
Dim getRow As Integer 'prodDataGridView.CurrentRow.Index
Dim subT As Double
Dim grandT As Double
Dim cnt As Integer = 1
Dim lastitem As Boolean = False
Private Sub Exitbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim strAns As String
strAns = CStr(MsgBox("Are you sure you want to exit this program?", MsgBoxStyle.YesNo + MsgBoxStyle.Question + MsgBoxStyle.DefaultButton2, "Please Confirm"))
If strAns = CStr(MsgBoxResult.Yes) Then
login.Show()
Me.Close()
End If
End Sub
Private Sub POSfrm_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
My.Settings.myForm = Me.Name
End Sub
Private Sub POSfrm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim rpmscmd As New OracleCommand
Dim rpmsds As New DataSet
Dim rpmsda As New OracleDataAdapter
rpmscmd.Connection = rpmscon
rpmscmd.CommandType = CommandType.Text
rpmscmd.CommandText = "select * from products"
rpmsda = New OracleDataAdapter(rpmscmd)
rpmsda.Fill(rpmsds, "products")
prodDataGridView.AutoGenerateColumns = False
prodDataGridView.DataSource = rpmsds
prodDataGridView.DataMember = "products"
End Sub
Private Sub prodDataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles prodDataGridView.CellContentClick
End Sub
Private Sub prodDataGridView_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles prodDataGridView.SelectionChanged
getRow = prodDataGridView.CurrentRow.Index
'Dim getindex As Integer = prodDataGridView.CurrentRow.Index
selItemlbl.Text = prodDataGridView.Rows(getRow).Cells.Item(0).Value
End Sub
Private Sub AddItemButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddItemButton.Click
'Dim getRow As Integer = prodDataGridView.CurrentRow.Index
Dim edate As Date = CDate(prodDataGridView.Rows(getRow).Cells.Item(4).Value)
subT = CDbl(prodDataGridView.Rows(getRow).Cells.Item(2).Value)
'Checks the timespan between the expiry date and NOW before it adds the one line of product to-be-sold to list and sales summary
If DetermineNumberofDays(prodDataGridView.Rows(getRow).Cells.Item(4).Value) > 0 Then
'numbers sales list
lst = salesListView.Items.Add(cnt)
'adds product to product column in sales list
lst.SubItems.Add(selItemlbl.Text)
'adds quantity to qty colum in sales list
lst.SubItems.Add(selQtytxb.Text)
'adds the product of selling_price and qty to the cost column in the sales list
lst.SubItems.Add((prodDataGridView.Rows(getRow).Cells.Item(2).Value) * (selQtytxb.Text))
'increases the subTotalLabel by the cost
subTotallbl.Text = CDbl(subTotallbl.Text) + subT
gTotallbl.Text = CDbl(gTotallbl.Text) + subT
If DetermineNumberofDays(prodDataGridView.Rows(getRow).Cells.Item(4).Value) < 30 Then
MsgBox(prodDataGridView.Rows(getRow).Cells.Item(0).Value & " expires on " & edate.ToShortDateString())
End If
cnt = cnt + 1
ElseIf DetermineNumberofDays(prodDataGridView.Rows(getRow).Cells.Item(4).Value) < 0 Then
MsgBox("BEWARE! " & prodDataGridView.Rows(getRow).Cells.Item(0).Value & " expired on " & edate.ToShortDateString() & ". You are not allow to sell it.")
End If
selQtytxb.Text = "1"
End Sub
Private Sub LinkLabel2_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
login.Show()
Me.Close()
End Sub
Private Sub RemoveItemBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoveItemBtn.Click
'If lst.ListView.SelectedItems(0).Index = lst.ListView.Items.Count - 1 Then
' MsgBox("its equal")
' lastitem = True
'End If
For Each lst As ListViewItem In salesListView.SelectedItems
lst.Remove()
cnt = cnt - 1
'subTotallbl.Text = CDbl(subTotallbl.Text) - salesListView.SelectedItems.ToString
Next
Try
'If lastitem = False Then
Dim i As Integer
If cnt > 1 Then
Dim numlist As New ListView
numlist = salesListView
For i = 0 To numlist.Items.Count - 1
numlist.Items(i).Text = i + 1
Next
End If
Catch ex As SystemException
MsgBox(ex.Message)
End Try
'Else
''to reset after last item is deleted
'lastitem = False
'End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
End Sub
Private Sub unPOS_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs)
End Sub
Private Sub unPOS_LinkClicked_1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles unPOS.LinkClicked
userDetails.Show()
Me.Close()
End Sub
End Class
Kofi
|
|
|
|
|
Not the whole thing, just the suspect trouble spot in the code
I would single step through everything in the debugger. Also, use the code block tag at the bottom to make it easier to read.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
How to convert C# to visual basic....?
|
|
|
|
|
Are you talking about code or what ?
Parwej Ahamad
R & D: REST services with WCF
|
|
|
|
|
How about a more meaningful subject line?
Learn to google for code converters, you'll be amazed at what you can find
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Fire the C# guys and hire VB6 guys code monkeys...??
|
|
|
|
|
muhahahha.
What convert the code? Just call it from what you're working with.
|
|
|
|
|
drop all tabs, semicolons, curly brackets.
add an End here and there.
|
|
|
|
|
I'm converting a VB6 app that uses the MS COMM control that sends data to various types of printers. I'm now trying to remove the VB MSComm control references and instead use the System.IO.SerialPort class instead.
I need help with the following code block:
strInString = objComm.Input
objComm.InputLen = 0
sngCheckTime = Timer + 2
Do
DoEvents
If sngCheckTime < Timer Then
CheckPrinterStatus = 2
Exit Function
End If
Loop Until objComm.InBufferCount > 0
Is SerialPort.ReadLine the equiv of objComm.Input?
What should this be changed to? Loop Until objComm.InBufferCount > 0
Thanks for anyone who can shed light on this.
|
|
|
|
|
Hi All
I wonder if someone could help me with the following;
Our ogranisation would like to have access to a list of the QBDG's in our Active Directory, and then select a group to get a list of the members of the QBDG's via web pages (delivered by web project in VB 2005).
Within Active Directory, the structure is set up as follows;
company.com
- Business Unit
- Computers
- Groups
- Printers
- Users
- Business Unit
- Computers
- Groups
- Printers
- Users
- Business Unit
- Computers
- Groups
- Printers
- Users
.... and so on
The QBDG's therefore are in a number of different folders. I've tried various LDAP queries, but haven't got this at all, lol.
Please could someone help;
1) Obtain a list of ALL QBDG's based on the above structure
2) Obtain a list of Users of one of the groups once selected
Thanks for looking at my problem
Brian
|
|
|
|
|
hi,
How can i programmatically check whether SQL Server is installed on the system or not ?.Also how can i check what is the name of Server instance.
|
|
|
|
|
I would try Google [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Talk is silver, silence is golden....
|
|
|
|
|
Check to see if the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion exists. If it exists, then as expected it contains the version number of the installed SQL Server.
|
|
|
|
|
--> Study "SMO Objects". You will learn alot...!
J A Nasir K
|
|
|
|
|
I need to control the properties of a logitech webcam, such as the gain and apperture settings, via VB without using the properties window supplied by the driver software. I've contacted Logitech and got no help there, has anyone got the list of commands / method of writing directly to the webcam?
|
|
|
|
|
Something like this[^] helpful?
|
|
|
|
|
Hi All,
I am writing a program to open a word document located in the server from a client application using which is using VB6. the vb.net application is a setup as a web service on our server. i went to the dcomcnfg and did the necessary configurations and set impersonate to true with a user name and a password and that bit works fine.
But when it creates a document it gives the following error message which i have tried to workout for the last two hours without success.
This is my code
<webmethod()> _
Public Function Regional_Franchise_Agreement(ByVal BusinessID As String)
Try
With Check_Session(Context)
wa = New Word.Application()
'Open and change the Regional Disclosure Document 04 06 08
wd = wa.Documents.Open(stTemplate_Location & "/Regional_Franchise_Agreement_04_06_08.doc")
wa.Visible = False
If htMain.Item("Special_Conditions").ToString = "0" Then
wd.Bookmarks.Item("SpecialConditions").Select()
wa.Selection.Delete()
Else
Call Find_and_Replace("[Special_Condition_Text]", htMain.Item("Special_Condition_Text").ToString)
End If
'wd1.SaveAs(stOut_File_Location & "/" & htMain.Item("Company_Name").ToString & "_" & htMain.Item("ABN").ToString & "/Regional_Franchise_Agreement_04_06_08.doc")
wd.SaveAs(stOut_File_Location & "/Regional_Franchise_Agreement_04_06_08.doc")
End With
Catch ex As Exception
Insert_Signup_Warnings(BusinessID, 1, ex.Message)
Finally
wd.Close(Word.WdSaveOptions.wdDoNotSaveChanges)
wa.Quit()
wd = Nothing
wa = Nothing
ChDir("c:/")
End Try
End Function
Thanks in advance for ant help.
This is the error Message:
System.NullReferenceException: Object reference not set to an instance of an object.
at FMS4NET.FSO_Signup.Regional_Franchise_Agreement(String BusinessID) in C:\Inetpub\fms4net\kanchana.ratnayake\App_Code\FSO_Signup.vb:line 58
Kev
|
|
|
|
|
Hi,
Can anyone help me here to translate this? It´s from a help file that is only coded in vb.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
CType(objForm, Form1).Label2.Text = TextBox1.Text
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyForm As New Form2()
MyForm.objForm = Me
MyForm.SetBounds(400, 400, 300, 300)
MyForm.Show()
End Sub
Public Property Form2Value() As String
Get
Return MyVal
End Get
Set(ByVal Value As String)
MyVal = Value
End Set
End Property
Thanks
|
|
|
|
|
nelsonpaixao wrote: help me here to translate this?
No. But, you can find translator utilities, though not always perfect, they are helpful. The code you supplied is very straightforward. You might want to read up on programming VB.NET and C#.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
You can use SharpDevelop[^]. There is build in tool to translate code from VB to C#
|
|
|
|
|
|
|
A translation of that code isn't really sufficient. You should clean up the code in the process.
nelsonpaixao wrote: CType(objForm, Form1).Label2.Text = TextBox1.Text
Why isn't the variable objForm of the type Form1 ? The only reason that you need a cast is that the variable is of the wrong type.
nelsonpaixao wrote: Dim MyForm As New Form2()
MyForm.objForm = Me
Don't expose objForm publically, send the reference in the constructor instead.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi, Guffa
The code is not mine, don´t ask me!!! I don´t understand it!!!
Thanks
|
|
|
|