|
OK I am going to go try this. Thanks!
|
|
|
|
|
You're welcome
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
is there anything that can give me an example of encryption program with vb.net?
|
|
|
|
|
Plenty of examples to choose from[^]
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Yes, it's called "a programmer".
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
sorry if my question is inappropriate, I'm a newbie trying to make a program, I also already have an encryption program just that I still need materials for reference, once again I'm sorry
|
|
|
|
|
Yes, it's called a "serarch engine". Perhaps you've heard of Google, Bing, Yahoo, ...???
It's quite easy to find if you just type "vb.net encryption tutorial" into any of these search engines.
|
|
|
|
|
thanks for the advice
|
|
|
|
|
Heres one:
Encrypting a dataset using AES[^]
We generally like it when you try something by yourself first, and then ask questions when you are stuck on a specific issue.
|
|
|
|
|
I Have An Application That Prints On Remote printers
I Need To Check printer Status If Printer Is Not Ready Or Has Any Problem Like Either Its Offline Or Paper Jam Or Out Of Paper To Notify User And Abort Printing
As This An Application For A Restaurant And It Prints Order In The Kitchen So If Print Order Sent To Printer Of To Print Manager The User Will Assume That Order Is In Queue
If An error Message Is Displayed Of Any Error Then The Order Should Be Reprinted And An Error Report Is saved To Disk
Many Function On The Internet Found Is Not What I Am Looking For, As If Printing Is Offline The Status returned That Printer In Ready
Any Help On This Matter?????3
wahid kalo
|
|
|
|
|
wkalo wrote: Many Function On The Internet Found Is Not What I Am Looking For, As If Printing Is Offline The Status returned That Printer In Ready
Depends on the printer-driver. Is the driver says it's ready to print, Windows will not know that there's an error, until one is thrown during the actual printing. Meaning, you'll always get the same status reported as Windows does. What have you looked at?
The "old" way of doing this is to use a special roll of paper; when the printer is "nearly" out of paper, it turns a different color, alerting the person yanking out the order that he/she should replace the paper soon. Wouldn't that be preferred for a restaurant?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
You Are Correct In Some Cases
But When You Are Using Network Printer It Means Your Data Input In One Place And The Printer In Another, There IS No Way For The user To Know Or See That The Printer Is In Need of A New Paper Roll, Also if The Computer Where The printer Is Connected Went Offline And There Is And Order To Print, Technically the print Manager Assumes is printed But Actually the order Did Arrive To Destination
wahid kalo
|
|
|
|
|
The Below Routine Shows If Printer Is Online Or Not It Works Perfectly
Public Function IsPrinterOnline(ByVal printerName As String) As Boolean
Dim str As String = ""
Dim online As Boolean = False
'set the scope of this search to the local machine
Dim scope As New ManagementScope(ManagementPath.DefaultPath)
'connect to the machine
scope.Connect()
'query for the ManagementObjectSearcher
Dim query As New SelectQuery("select * from Win32_Printer")
Dim m As New ManagementClass("Win32_Printer")
Dim obj As New ManagementObjectSearcher(scope, query)
'get each instance from the ManagementObjectSearcher object
Using printers As ManagementObjectCollection = m.GetInstances()
'now loop through each printer instance returned
For Each printer As ManagementObject In printers
'first make sure we got something back
If printer IsNot Nothing Then
'get the current printer name in the loop
str = printer("Name").ToString().ToLower()
'check if it matches the name provided
If str.Equals(printerName.ToLower()) Then
MessageBox.Show(printer("PrinterStatus"))
'since we found a match check it's status
If printer("WorkOffline").ToString().ToLower().Equals("true") OrElse printer("PrinterStatus").Equals(7) Then
'it's offline
online = False
MessageBox.Show(str & " " & online)
Else
'it's online
online = True
End If
End If
Else
Throw New Exception("No printers were found")
End If
Next
End Using
Return online
End Function
wahid kalo
|
|
|
|
|
Thanks for adding in the answer for future reference. You might want to consider to submit it as a Trick[^].
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi everyone,
My update statement itself doesn't have problem but when I successfully updated the bank balance and wallet cash balance, I need those 2 value to be past to the next record's bank balance and wallet cash balance with auto Calcute with the existed enter data and saved.
For example:
Data1
Date:08/09/2012
{
Breakfast: 10
Lunch: 10
Sub: 20
}
{
Mortgage: 100
Instalment: 200
sub: 300
}
{
Total: 320
}
{
Wallet Cash: 1000 (1320-320)
}
Data2
Date:09/09/2012
{
Breakfast: 10
Lunch: 30
Sub: 20
}
{
Mortgage: 100
Instalment: 200
sub: 300
}
{
Total: 350
}
{
Wallet Cash: 650 (1000 - 350)
Let's say if I change data 1's breakfast to 90 then the sub will be 100 and the total is 400. Then 1320 - 400 = Walletcash(920). Then save.
After saving how to pass 920 to data 2's wallet cash = 920 - 350 = 570 and auto save to database. This should also be done with others data like 2 onwards till the last record.
I have coded the program to use textchange,gotfocus, and lostFocus to auto calculate when user change the textbox value. Is this way good/correct or should use sql to calculate for me.
So can some give me some ideas, example, pointer to my problem. My code is very long; so, I am reluctant to put here. If you need it tell me please.
|
|
|
|
|
Hmmm ... consider this.
Not knowing how your data is stored or the amount of data being stored, I'll throw an idea out to you.
Think of this like an accounting system where you have:
1) Transaction date
2) Transaction amount
3) Account Code
4) Tranasction description
In your situation, you would have 2 accounts: W-Wallet, B-Bank
Each time you perform a transaction you have to hit the right account. To get the current balance, you would sum the amounts for that account.
For example, the first two transaction would "open" your accounts:
1) Jan 1 deposit $500 to the Bank account
2) Jan 2 deposit $100 to the Wallet account.
Here are some example transactions:
1/1/2012, +500, B, Opening deposit
1/1/2012, +100, W, Opening deposit
8/9/2012, -10, W, Breakfast
8/9/2012, -10, W, Linch
8/9/2012, -100, W, Mortgage
By summing the transacitons for B or W you could determine the balance in the account at any point in time.
Maybe this would work for you.
|
|
|
|
|
Firstly, thank you very much for the kind info but I am not sure of that.
My program is an Expenses Management. The User's will enter values to the prepared templates and then save.
When the user wanted to add a new data for the next date. Here the previous data wallet will be at the new data input template where the user will start entering value and then the wallet value will decrease and saved.(Add data is perfectly fine)
The problem is in editing(Update data). When I edit the 1st data its normal for the wallet's value to changed right and then save. Here's the problem, the changed wallet value have to be pass to the next data wallet and minus the other value to get the true value; as well as, the rest of the data.
So, how do I update these data because update only updates a selected row data only or to say how to get the wallet amount correct onwards from the other rows from the middle or previous row?
I have multiple tables that is an one to one relationship to a main table where the inside the main table has Wallet in it.
I'll show my working update statement and auto calculation here for better understanding:
Quote: Sub Update_Data()
Try
UpdateFnB = "Update tblFoodAndBeverage SET Breakfast = @Breakfast, Lunch = @Lunch, Dinner = @Dinner, Supper = @Supper, Snack = @Snack, Beverage = @Beverage, Grocerries = @Grocerries, Sub_Total = @SubFnB WHERE Food_And_BeverageID = '" & LVDailyExpenses.DataGridView1.CurrentRow.Cells(0).Value.ToString & "' "
sqlFnB = New SqlCommand(UpdateFnB, connection)
sqlFnB.Parameters.AddWithValue("@Breakfast", txtBreakFeast.Text)
sqlFnB.Parameters.AddWithValue("@Lunch", txtLunch.Text)
sqlFnB.Parameters.AddWithValue("@Dinner", txtDinner.Text)
sqlFnB.Parameters.AddWithValue("@Supper", txtSupper.Text)
sqlFnB.Parameters.AddWithValue("@Snack", txtSnack.Text)
sqlFnB.Parameters.AddWithValue("@Beverage", txtBeverage.Text)
sqlFnB.Parameters.AddWithValue("@Grocerries", txtGroceries.Text)
sqlFnB.Parameters.AddWithValue("@SubFnB", txtSubFnB.Text)
sqlFnB.ExecuteNonQuery()
UpdatePCnI = "Update tblPersonalCareAndItems SET Medical_Fees = @Medical, Hair_Or_Nail = @HairNail, Clothing = @Cloth, Supplements = @Supplement, Soap_Or_Shampoo = @SoapShampoo, Facial_Cleanser = @Facial, Others = @PCnIOthers, Sub_Total = @SubPCnI WHERE Personal_Care_And_ItemsID = '" & LVDailyExpenses.DataGridView1.CurrentRow.Cells(0).Value.ToString & "' "
sqlPCnI = New SqlCommand(UpdatePCnI, connection)
sqlPCnI.Parameters.AddWithValue("@Medical", txtMedical.Text)
sqlPCnI.Parameters.AddWithValue("@HairNail", txtHairNail.Text)
sqlPCnI.Parameters.AddWithValue("@Cloth", txtClothing.Text)
sqlPCnI.Parameters.AddWithValue("@Supplement", txtSupplement.Text)
sqlPCnI.Parameters.AddWithValue("@SoapShampoo", txtSoapShampoo.Text)
sqlPCnI.Parameters.AddWithValue("@Facial", txtFacial.Text)
sqlPCnI.Parameters.AddWithValue("@PCnIOthers", txtPCnIOthers.Text)
sqlPCnI.Parameters.AddWithValue("@SubPCnI", txtSubPCnI.Text)
sqlPCnI.ExecuteNonQuery()
UpdateEntertainment = "Update tblEntertainment SET Video_Rental = @Video, Cinema = @Cinema, Concert = @Concert, Sport = @sport, Games = @games, Club_Bar_Disco = @clubbardisco, Others = @EntertainmentOthers, Sub_Total = @SubEntertainment WHERE EntertainmentID = '" & LVDailyExpenses.DataGridView1.CurrentRow.Cells(0).Value.ToString & "'"
sqlEntertainment = New SqlCommand(UpdateEntertainment, connection)
sqlEntertainment.Parameters.AddWithValue("@Video", txtVideo.Text)
sqlEntertainment.Parameters.AddWithValue("@Cinema", txtCinema.Text)
sqlEntertainment.Parameters.AddWithValue("@Concert", txtConcert.Text)
sqlEntertainment.Parameters.AddWithValue("@sport", txtSport.Text)
sqlEntertainment.Parameters.AddWithValue("@games", txtGames.Text)
sqlEntertainment.Parameters.AddWithValue("@clubbardisco", txtClubBarDisco.Text)
sqlEntertainment.Parameters.AddWithValue("@EntertainmentOthers", txtEntertainmentOthers.Text)
sqlEntertainment.Parameters.AddWithValue("@SubEntertainment", txtSubEntertainment.Text)
sqlEntertainment.ExecuteNonQuery()
UpdatePnO = "Update tblPaymentsAndOthers SET Phone_Bill = @phone, College_Fee_And_Misc = @college, Vehicle_Payment = @VP, Vehicle_License = @VL, Vehicle_Insurance = @VI, Credit_Card = @Credit, [Debit_Card] = @Debit, [Others] = @PnOOthers, Sub_Total = @SubPnO WHERE Payments_And_OthersID = '" & LVDailyExpenses.DataGridView1.CurrentRow.Cells(0).Value.ToString & "'"
sqlPnO = New SqlCommand(UpdatePnO, connection)
sqlPnO.Parameters.AddWithValue("@phone", txtPhoneBill.Text)
sqlPnO.Parameters.AddWithValue("@college", txtCollegeFeeAndMisc.Text)
sqlPnO.Parameters.AddWithValue("@VP", txtVehiclePayment.Text)
sqlPnO.Parameters.AddWithValue("@VL", txtVehicleLicense.Text)
sqlPnO.Parameters.AddWithValue("@VI", txtVehicleInsurance.Text)
sqlPnO.Parameters.AddWithValue("@Credit", txtCardCredit.Text)
sqlPnO.Parameters.AddWithValue("@Debit", txtDebitCard.Text)
sqlPnO.Parameters.AddWithValue("@PnOOthers", txtPnOOthers.Text)
sqlPnO.Parameters.AddWithValue("@SubPnO", txtSubPaymentnOthers.Text)
UpdateTransport = "Update tblTransportation SET [Bus_Fare] = @Bus, [Taxi_Fare] = @Taxi, [Train_Fare] = @Train, [Fuel] = @Fuel, [Maintainence] = @Maintain, [Others] = @TransOther, [Sub_Total] = @SubTransport WHERE TransportationID = '" & LVDailyExpenses.DataGridView1.CurrentRow.Cells(0).Value.ToString & "'"
sqlTransport = New SqlCommand(UpdateTransport, connection)
sqlTransport.Parameters.AddWithValue("@Bus", txtBusFare.Text)
sqlTransport.Parameters.AddWithValue("@Taxi", txtTaxiFare.Text)
sqlTransport.Parameters.AddWithValue("@Train", txtTrainFare.Text)
sqlTransport.Parameters.AddWithValue("@Fuel", txtFuel.Text)
sqlTransport.Parameters.AddWithValue("@Maintain", txtMaintainence.Text)
sqlTransport.Parameters.AddWithValue("@TransOther", txtTansportOthers.Text)
sqlTransport.Parameters.AddWithValue("@SubTransport", txtSubTransport.Text)
sqlTransport.ExecuteNonQuery()
UpdateHousing = "Update tblHousing SET [Rental] = @Rental, [Electricity] = @Electricity, [Water] = @Water, [Gas] = @Gas, [Supplies] = @Supplies, [Other] = @HousingOthers, [Sub_Total] = @SubHousing WHERE HousingID = '" & LVDailyExpenses.DataGridView1.CurrentRow.Cells(0).Value.ToString & "'"
sqlHousing = New SqlCommand(UpdateHousing, connection)
sqlHousing.Parameters.AddWithValue("@Rental", txtRental.Text)
sqlHousing.Parameters.AddWithValue("@Electricity", txtElectricity.Text)
sqlHousing.Parameters.AddWithValue("@Water", txtWater.Text)
sqlHousing.Parameters.AddWithValue("@Gas", txtGas.Text)
sqlHousing.Parameters.AddWithValue("@Supplies", txtSupplies.Text)
sqlHousing.Parameters.AddWithValue("@HousingOthers", txtHousingOthers.Text)
sqlHousing.Parameters.AddWithValue("@SubHousing", txtSubHousing.Text)
sqlHousing.ExecuteNonQuery()
UpdateLoan = "Update tblLoan SET [Personal] = @Personal, [Student] = @Student, [Business] = @Business, [Mortgage] = @Mortgage, [Others] = @LoanOthers, [Sub_Total] = @SubLoan WHERE LoanID = '" & LVDailyExpenses.DataGridView1.CurrentRow.Cells(0).Value.ToString & "'"
sqlLoan = New SqlCommand(UpdateLoan, connection)
sqlLoan.Parameters.AddWithValue("@Personal", txtPersonal.Text)
sqlLoan.Parameters.AddWithValue("@Student", txtStudent.Text)
sqlLoan.Parameters.AddWithValue("@Business", txtBusiness.Text)
sqlLoan.Parameters.AddWithValue("@Mortgage", txtMortgage.Text)
sqlLoan.Parameters.AddWithValue("@LoanOthers", txtLoanOthers.Text)
sqlLoan.Parameters.AddWithValue("@SubLoan", txtSubLoan.Text)
sqlLoan.ExecuteNonQuery()
UpdateLegal = "Update tblLegal SET [Attorney] = @Attorney, [Alimony] = @Alimony, [Summons] = @Summons, [Others] = @LegalOthers, [Sub_Total] = @SubLegal WHERE LegalID = '" & LVDailyExpenses.DataGridView1.CurrentRow.Cells(0).Value.ToString & "'"
sqlLegal = New SqlCommand(UpdateLegal, connection)
sqlLegal.Parameters.AddWithValue("@Attorney", txtAttorney.Text)
sqlLegal.Parameters.AddWithValue("@Alimony", txtAlimony.Text)
sqlLegal.Parameters.AddWithValue("@Summons", txtSummon.Text)
sqlLegal.Parameters.AddWithValue("@LegalOthers", txtLegalOthers.Text)
sqlLegal.Parameters.AddWithValue("@SubLegal", txtSubLegal.Text)
UpdateBanking = "Update tblBanking SET [Maybank_Balance] = @Maybank, [Maybank_Withdraw] = @MaybankW, [Maybank_Deposit] = @MaybankD, [CIMB_Balance] = @CIMB, [CIMB_Withdraw] = @CIMBW, [CIMB_Deposit] = @CIMBD, [Public_Bank_Balance] = @Public, [Public_Bank_Withdraw] = @PublicW, [Public_Bank_Deposit] = @PublicD, [Other_Bank_Balance] = @OtherBank, [Other_Bank_Withdraw] = @OtherBankW, [Other_Bank_Deposit] = @OtherBankD WHERE BankingID = '" & LVDailyExpenses.DataGridView1.CurrentRow.Cells(0).Value.ToString & "'"
sqlBanking = New SqlCommand(UpdateBanking, connection)
sqlBanking.Parameters.AddWithValue("@Maybank", txtMaybank.Text)
sqlBanking.Parameters.AddWithValue("@MaybankW", txtMaybankWithdraw.Text)
sqlBanking.Parameters.AddWithValue("@MaybankD", txtMaybankDeposit.Text)
sqlBanking.Parameters.AddWithValue("@CIMB", txtCIMB.Text)
sqlBanking.Parameters.AddWithValue("@CIMBW", txtCIMBWithdraw.Text)
sqlBanking.Parameters.AddWithValue("@CIMBD", txtCIMBDeposit.Text)
sqlBanking.Parameters.AddWithValue("@Public", txtPublicBank.Text)
sqlBanking.Parameters.AddWithValue("@PublicW", txtPublickBankWithdraw.Text)
sqlBanking.Parameters.AddWithValue("@PublicD", txtPublickBankDeposit.Text)
sqlBanking.Parameters.AddWithValue("@OtherBank", txtOtherBank.Text)
sqlBanking.Parameters.AddWithValue("@OtherBankW", txtOtherBankWithdraw.Text)
sqlBanking.Parameters.AddWithValue("@OtherBankD", txtOtherBankDeposit.Text)
UpdateExpenses = "Update tblExpenses SET [Date] = @Date, [Allowance] = @Allowance, [Total] = @Total, [Wallet] = @Wallet WHERE ExpensesID = '" & LVDailyExpenses.DataGridView1.CurrentRow.Cells(0).Value.ToString & "'"
sqlExpenses = New SqlCommand(UpdateExpenses, connection)
sqlExpenses.Parameters.AddWithValue("@Date", DateTimePicker1.Value)
sqlExpenses.Parameters.AddWithValue("@Allowance", txtAllowance.Text)
sqlExpenses.Parameters.AddWithValue("@Total", txtTotalUsage.Text)
sqlExpenses.Parameters.AddWithValue("@Wallet", txtWalletCash.Text)
MsgBox("Successfully Edited Expenses")
Call LVDailyExpenses.Fill_Data()
Me.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
connection.Close()
End Sub
Auto Calculation:
Quote: Private Sub txtSubLegal_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSubLegal.TextChanged
If Not String.IsNullOrEmpty(txtSubLegal.Text) Then
If txtSubLegal.Text >= 0 Then
total_old = txtTotalUsage.Text
Total = SubFnB + SubEntertainment + SubPCnI + SubPnO + SubTransport + SubHousing + SubLoan + SubLegal
txtTotalUsage.Text = Total.ToString("#,###.00")
Wallet = txtWalletCash.Text
Wallet = (Wallet + total_old - Total)
txtWalletCash.Text = Wallet.ToString("#,###.00")
End If
End If
End Sub
Quote: Private Sub txtPublickBankWithdraw_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtPublickBankWithdraw.GotFocus
Old_PublicBank_Wthdraw = txtPublickBankWithdraw.Text
End Sub
Private Sub txtPublickBankWithdraw_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtPublickBankWithdraw.LostFocus
If Not String.IsNullOrEmpty(txtPublickBankWithdraw.Text) Then
If IsNumeric(txtPublickBankWithdraw.Text) Then
Public_Bank_Balance = txtPublicBank.Text
Public_Bank_Withdraw = txtPublickBankWithdraw.Text
New_Publicbank_Balance = Public_Bank_Balance - Public_Bank_Withdraw + Old_PublicBank_Wthdraw
txtPublicBank.Text = New_Publicbank_Balance.ToString("#,###.00")
Wallet = txtWalletCash.Text
Wallet1 = Wallet + Public_Bank_Withdraw - Old_PublicBank_Wthdraw
txtWalletCash.Text = Wallet1.ToString("#,###.00")
Else
MsgBox("Please Fill In Numerical Value!")
txtPublickBankWithdraw.Text = Old_PublicBank_Wthdraw.ToString("#,###.00")
End If
End If
End Sub
|
|
|
|
|
Wow. That is a lot of detail to go through ... Sorry I can't spend that much time going through each line of code.
Here are some suggestions:
1) You may want to investigate using transactions so that you can guarantee data consistency among all of your tables. If there is an update failure in one table, rollback the transaction and the data remains consistent. Commit only when you know that all updates have taken place correctly.
2) If you need to obtain the wallet amount at any point in your update, yoyou can issue a SqlCommand.ExecuteScalar function and get a numeric value.
Hope that helps.
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executescalar.aspx[^]
|
|
|
|
|
Okay thanks for the pointer.
|
|
|
|
|
what is textmatrix in datagrid component...and if any one help me out how manually we get database connectivity steps...
|
|
|
|
|
sandy2050 wrote: what is textmatrix in datagrid component...
Part of the MSFlexGrid[^] monster.
sandy2050 wrote: <layer>.and if any one help me out how manually we get database connectivity steps...
Visual Basic 6 is being phased out. Best way to communicate with a database is using .NET; you can use the .NET code from your existing VB6-app, and all the tools are available for free.
I too, have stopped supporting VB6. Google is your friend.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I was wondering if anyone knew of a script I could modify to allow end users to update the Global Address List - I know there are tools available to purchase but i wish to create my own and am looking for some guidance on the subject.
Please be patient - I only have 2 speeds and if you don't like this one then you definitely won't like the other!
|
|
|
|
|
Try this[^] or this[^] site.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
hello .. i hd a form , what i want is that the user will search the database either by entering Party Name or By date ..I hd succesfully acheived this , but the problem is that , when i search for partyname , the result are showned in datagrideview , but when u tried to search again the previous result does not go , its still present in datgridview..how do i get out of it ...
for much better understanding i hd posted image down there ..plz help me out
Private Sub Search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Da = New OleDb.OleDbDataAdapter("Select * from demo where DateOfPurchase = '" + txtsdateofpurchase.Text + "'", Cnn)
Da.Fill(ds, "demo")
DataGridView1.DataSource = ds.Tables(0)
DataGridView1.Refresh()
End Sub
|
|
|
|
|
I don't use the tableadapters that often; it looks however as if you're continuously adding records. Try clearing the datasource beforing filling.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|