|
I could be wrong, but this looks like it should read
cmd.CommandText ="select ID from table where name like '%" & checkstr & "'"
Gaming at the GuildofBlades.com is the only way to really experiece the level 99 Soul-Sucking Sword!
|
|
|
|
|
As the lines that you read contains several words, and the data in the database is single words, you should look for the word in the string, instead of the opposite:
cmd.CommandText =select ID from table where '" & checkstr & "' like '%'+name+'%'"
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: cmd.CommandText =select ID from table where '" & checkstr & "' like '%'+name+'%'"
Not
cmd.CommandText = "select ID from table where '" & checkstr & "' like '%'" + name + "'%'" ?
Christian Graus - C++ MVP
|
|
|
|
|
You are right. I missed that the OP missed the starting quote.
Still, that's just syntax. That's not the hard part.
---
b { font-weight: normal; }
|
|
|
|
|
You'd like to think so, I was amazed you did get an 'I got an error' response.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
thx guys
this helped me
i apriciate it
Regards
Ramy
|
|
|
|
|
Hi All,
I got a code module in which the following declaration was found:
Public Declare Function SetupDiGetClassDevs Lib "setupapi.dll" _
Alias "SetupDiGetClassDevsA" ( _
ByRef ClassGuid As SP_GUID, _
ByVal Enumerator As String, _
ByVal hwndParent As Integer, _
ByVal Flags As Integer) As Integer
Can you help me find the exactly how shouid i get this API to be declared as above.In Visual Studio6.0 Tools i seacrhed in API text viewer but the above API was not found at all.
Thank you in advance.
|
|
|
|
|
I have had some trouble with this one.
How can I Display the contents of the Run Registry value in a textbox?
Just incase you are wondering, this key is located in the registry at:
HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Run
|
|
|
|
|
MessageBox.Show.
Reading the registry is also widely documented.
Christian Graus - C++ MVP
|
|
|
|
|
Thanks on the quick reply, how would I use message box.Show to display it? like this?
Messagebox.show ("HKEY_L...") ? sorry I am allmost certain that is wrong as that just displays text.
|
|
|
|
|
My point was that even if you typed the question in to google as you typed it here, you'd probably find heaps of articles on how to read the registry.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
HI, This Code to Reading fro registry
<code>Imports Microsoft.Win32
Registry.LocalMachine.OpenSubKey("SOFTWARE", True).OpenSubKey("Microsoft", True).OpenSubKey("Windows", True).OpenSubKey("CurrentVersion", True).OpenSubKey("run",True).GetValue(OBJECTNAME</i)</code>>
The OBJECTNAME must be replaced by value name in the Key (RUN) e.g. "TkBellExe"
Mohamad A. Flefel
mflefel@hotmail.com
+962 79 5963865
C#.net & VB.net Developer
|
|
|
|
|
Thanks for the code snippit and for Chris, I know how to read and write to the registry AND I also know what messagebox.Show does EXACTLY but how is that gonna help me, my question was How can I display the contents of the RUN registry key in a TEXTBOX (thats already on the form) not a message box, I know how to display registry VALUES in a textbox but I do not know how to display the entire contents of a registry SUBKEY.
|
|
|
|
|
|
Uh, ye thanks... ... lol
Would you recommend a Treeview then? if so I would need to know how as I have never worked with the Tree view control.
thanks
|
|
|
|
|
SLRGrant wrote: Would you recommend a Treeview then?
Yes!
MSDN is your good friend, there are samples about populating TreeViews.
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.
|
|
|
|
|
i think that u want to display the values entire the "RUN" Key if this correct ,try this code
Registry.LocalMachine.OpenSubKey("SOFTWARE", True).OpenSubKey("Microsoft", True).OpenSubKey("Windows", True).OpenSubKey("CurrentVersion", True).OpenSubKey("run", True).GetValueNames()
the GetValueNames() return the names of all values in key then u can read the value by using the getvalue("ObjectName") method then u can display them in any way u like
Mohamad A. Flefel
mflefel@hotmail.com
+962 79 5963865
C#.net & VB.net Developer
|
|
|
|
|
|
yay, thank you for the help guys, I should be fine from here
---------------------------
If I had a £0.01 for the amount of times I have said to people "USE GOOGLE" I would be richer than Bill Gates.
|
|
|
|
|
I am currently enrolled in a VB class and am completely new to the class and this forum so if you need any additional information please let me know. I hope this question makes sense to someone. lol
My current project requires me to do a summary with a running total of the number of deposits, amount of deposit, number of checks, amount of checks etc.
I am able to get the summary up in a new messagebox but it will only show the last transaction. for instance if I make a deposit, then write a check, the summary will only show the check written and the amount of the check. It will not show the deposit I made or the amount of the deposit. How can I get it to show all of the totals from all of the transactions?
If you need any code I can provide it for you.
Thanks,
Ruby
|
|
|
|
|
You need to show the code. The answer is, pass all the info you want to see, into the messagebox.
Christian Graus - C++ MVP
|
|
|
|
|
ok, here is the code:
Public Class CheckingAccount
Dim Service = "10.00"
Dim enterAmount As Decimal
Dim Balance As Decimal
Dim totalNumOfDeposit As Integer
Dim totalAmtOfDeposits As Decimal
Dim totalChecks As Decimal
Dim totalAmountOfChecks As Decimal
Dim totalAmountOfService As Decimal
Private Sub menTransaction_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menTransaction.Click
With Me
enterAmount = Decimal.Parse(txtAmount.Text)
If butDeposit.Checked = True Then
Balance = Balance + enterAmount
totalNumOfDeposit = totalNumOfDeposit + 1
totalAmtOfDeposits = totalAmtOfDeposits + enterAmount
ElseIf butCheck.Checked = True Then
Balance = Balance - enterAmount
totalChecks = totalChecks + 1
totalAmountOfChecks = totalAmountOfChecks + enterAmount
ElseIf butService.Checked = True Then
Balance = Balance - Service
totalAmountOfService = totalamountOfChecks + Service
End If
Me.txtBalance.Text = Balance.ToString("C")
Me.txtAmount.Clear()
Me.txtAmount.Focus()
End With
End Sub
Private Sub menSummary_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menSummary.Click
Dim Service As Decimal = "10.00"
Dim totalNumOfDeposit As Integer
Dim totalAmtOfDeposits As Decimal
Dim totalChecks As Decimal
Dim totalAmountOfChecks As Decimal
Dim totalAmountOfService As Decimal
Dim messageString As String
With Me
If butDeposit.Checked = True Then
totalNumOfDeposit = totalNumOfDeposit + 1
totalAmtOfDeposits = totalAmtOfDeposits + enterAmount
ElseIf butCheck.Checked = True Then
totalChecks = totalChecks + 1
totalAmountOfChecks = totalAmountOfChecks + enterAmount
ElseIf butService.Checked = True Then
totalAmountOfService = totalAmountOfService + Service
End If
messageString = "Total Deposits: " _
& totalNumOfDeposit.ToString() _
& ControlChars.NewLine _
& "Total Amount Of Deposits: " & totalAmtOfDeposits.ToString() _
& ControlChars.NewLine _
& "Total Checks: " & totalChecks.ToString() _
& ControlChars.NewLine _
& "Total Amount of Checks: " & totalAmountOfChecks.ToString() _
& ControlChars.NewLine _
& "Total Amount of Service Charges: " _
& totalAmountOfService.ToString()
MessageBox.Show(messageString, "Checking Account Summary", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
End With
End Sub
So, where do you think I've gone wrong?
Thanks for any help you can give me
Ruby
|
|
|
|
|
RubyM wrote: Dim Service As Decimal = "10.00"
Dim totalNumOfDeposit As Integer
Dim totalAmtOfDeposits As Decimal
Dim totalChecks As Decimal
Dim totalAmountOfChecks As Decimal
Dim totalAmountOfService As Decimal
Dim messageString As String
People used to do this in C, because they had to. You should declare variables as you use them.
So you're saying this message box doesn't show all of the messageString ? Does it show the constants you're passing in ?
RubyM wrote: totalAmountOfChecks.ToString()
I don't believe you need to call ToString, it works it out.
Have you stepped through the debugger to see what's happening ?
RubyM wrote: enterAmount = Decimal.Parse(txtAmount.Text)
You should use TryParse, in case invalid chars are entered.
Christian Graus - C++ MVP
|
|
|
|
|
ok, I stepped through the debugger and don't seem to find any problems (then again, I'm am new to this and probably didn't know what to look for)
the message box shows all of the messageString, but somewhere along the line it is not doing the calculations like it should.
If I have the deposit button checked and enter 3 transactions of $50
then click on the "check" button and enter a transaction of $100
then choose the summary option in my menu the summary should look like this:
Total Deposits: 3
Amount of Deposits: $150
Total checks: 1
Amount of Checks: $100
Total Service charge: $0
but instead it will only show this:
Total Deposits: 0
Amount of Deposits: 0
Total checks: 1
Amount of checks: $100
Total Service charge: $0
I also tried it without the ToString() call and I get "0" for everything in my summary, so I do need the ToString() call.
So that's my problem. It's not holding all of the transactions like it should so I can display them in my summary.
Ruby
|
|
|
|
|
OK, I see now. You initially said 'I'm not seeing them'.
Private Sub menSummary_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menSummary.Click
Dim Service As Decimal = "10.00"
Dim totalNumOfDeposit As Integer
Dim totalAmtOfDeposits As Decimal
Dim totalChecks As Decimal
Dim totalAmountOfChecks As Decimal
Dim totalAmountOfService As Decimal
Dim messageString As String
These are local variables. If you declare them outside of any method, then they will be member variables, which means they will keep their values between calls to this function.
Christian Graus - C++ MVP
|
|
|
|