|
There's no Char function for brackets, and because ( doesn't match } or ], you'd do better to build three stacks, one for each type of brackets. You could then pull them off for closing brackets from the right, and whatever is left on the stack, does not match anything to close it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i cant figure out how to work that with the string, when the array breaks it down what do i need to do for it to examine what it broke down to decide what stack to put it in
I tried if intI = ")", ect.... but it gave me a cant do it because Double error
|
|
|
|
|
You need to use single quotes to compare a char to a char, at least in C# you do.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
well single quotes in VB comment things out, and I cant see to figure it out
|
|
|
|
|
Something like this ? OR perhaps for each would work as nicely, and read better ?
Sub Main()
Dim s As String = "this (is )a ((test), sucka)"
Dim i As Int16
For i = 0 To s.Length
If s.Chars(i) = "(" Then
' push onto stack
End If
Next
End Sub
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
THanks, I am trying to figure it out
|
|
|
|
|
Glad to help. A lot of people post homework questions here, I have no time for them. However, people like you, who are trying to work it out for themselves and just need a little help, I'm always keen to help out.
Good luck.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Maybe you already figured it out, but a char in vb is something like
Dim c as Char = "("c
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
A good reference for parsing code (or whatever) is in Compilers, Principles techniques and Tools (aka The Dragon Book) by Aho, Sethi and Ullman, c. 198x?
...Steve
|
|
|
|
|
ahem..
Anybody knows how to use/connect an OpenDocument Database (OPEN-OFFICE DB), to VB.NET. ?
This is no emergency.
Thanks.!
Marvin N. Guerrero
- Taje Kage_bunshinNunJutsU
|
|
|
|
|
Is there an ODBC driver for it ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Guerven wrote: This is no emergency.
Sorry I don't know the answer, but full marks for stating this in your post!
...Steve
|
|
|
|
|
i want to select one row from one datagrid which is binding to a dataset, then click add button to add this row into the datagrid below, how to implement this ??
emergency!! so everyone pls help me!!
I am Entry level person
|
|
|
|
|
maxiachun wrote: i want to select one row from one datagrid which is binding to a dataset, then click add button to add this row into the datagrid below, how to implement this ??
Seems fairly straight forward to me. What is the problem you are experiencing? Elaborate more and you may get a sensible answer.
maxiachun wrote: emergency!! so everyone pls help me!!
What sort of emergency? If this is for a uni project/homework etc, sorry but you've come to the wrong place.
...Steve
|
|
|
|
|
hehe! i need a bit help becoz i have problem in Currency manager binding! so i want someone to give me some advice!
I am Entry level person
|
|
|
|
|
here is some code!
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
If cnn.State = ConnectionState.Closed Then
cnn.Open()
da.Fill(ds.ProductTable)
dv = New DataView(ds.ProductTable)
cm = CType(Me.BindingContext(Me.ds, "ProductTable"), CurrencyManager)
If System.IO.File.Exists(sFile) Then
Me.Prizes1.ReadXml(sFile)
End If
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
cnn.Close()
End Try
End Sub
Private Sub BtnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSearch.Click
Dim strFilter As String = "PLU_Number > 0"
If txtCode.Text.Length > 0 Then
strFilter = strFilter & "and Inventory_Code like '" & txtCode.Text & "%'"
End If
If txtPLU.Text.Length > 0 Then
strFilter = strFilter & "and PLU_Number like '" & txtPLU.Text & "%'"
End If
If txtDescription.Text.Length > 0 Then
strFilter = strFilter & "and Description like '" & txtDescription.Text & "%'"
End If
dv.RowFilter = strFilter
DataGrid1.DataSource = dv
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim dr As Prizes.PrizeTableRow
Try
With CType(cm.Current.row, ds.ProductTableRow)
dr = Me.Prizes1.PrizeTable.NewRow()
dr.Inventory_Code = .Inventory_Code
dr.Qty = 1
dr.Awarded = 0
Me.Prizes1.PrizeTable.Rows.Add(dr)
End With
Catch ex As Exception
End Try
End Sub
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Me.Prizes1.WriteXml(sFile)
End Sub
End Class
I am Entry level person
|
|
|
|
|
maxiachun wrote: here is some code!
Ok I see the code but what is the problem?
On what line are you getting an exception or is it just not working as you expected?
I'm not going to analyze it for you. Make it easy for me and I'll help.
...Steve
|
|
|
|
|
maxiachun wrote: Dim strFilter As String = "PLU_Number > 0"
If txtCode.Text.Length > 0 Then
strFilter = strFilter & "and Inventory_Code like '" & txtCode.Text & "%'"
Here's an issue. You need a space after the 0, otherwise it looks like this:
PLU_Number > 0and Inventory_Code like etc.
Looking at the values in the debugger is a good way to find errors like this one, and always trailing a space if you must build SQL like this is another. Of course, you shouldn't build your SQL like this, for starters, if this is a real world app, you're wide open to injection attacks.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
so what is the solution for building SQL how to do??
I am Entry level person
|
|
|
|
|
Well, at a bare minimum you should check the text for quotes, so that the string coming in doesn't close the quotes ( which is how an injection attack occurs ). There's at least one article here on CP about this, search for 'SQL injection' to find it.
Even if you use stored procs instead of building SQL, you're vunerable if you don't clean your input first.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Steve Pullan wrote: What sort of emergency?
There seems to be a growing trend of people with no skillset being asked to write code by their employers, and coming here for help. It's not their fault, really, it's the employers fault.
But you're right, it's equally possible he wants us to do his homework. I'd be happy to help him though, if he can demonstrate that he's tried to tackle the problem himself.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote: There seems to be a growing trend of people with no skillset being asked to write code by their employers, and coming here for help. It's not their fault, really, it's the employers fault.
But you're right, it's equally possible he wants us to do his homework. I'd be happy to help him though, if he can demonstrate that he's tried to tackle the problem himself.
Yep, I agree on all counts. My last reply (probably as you were writing this one to me) was a bit abrupt, but all I got was some source code. I'm not going to analyze anyone's code unless there is evidence that he/she has done some work and provided a decent description of the problem. Call me old fashioned
It saddens me that untrained people are actually cutting code. Part of the problem of such high level tools that make it easier I guess - and employers' expectations.
I'm glad you have more patience than me .
Anyway - back to lurking... Cheers
...Steve
|
|
|
|
|
Steve Pullan wrote: Call me old fashioned
No, I agree totally.
Steve Pullan wrote: t saddens me that untrained people are actually cutting code.
Yeah, I think it's a sign that employers are valuing what we do as being worth less and less. Not wanting to ignite the language wars, but it's definately more the case with VB than C++. In fact, I did a job in C# ( a video jukebox ) and the client would not consider C++ and was really keen on VB ( I refused the job in VB, due to personal preference ), because VB coders are 'cheap and easy to find', and that because 'VB is easy'. It's only a matter of time before this end of the market makes no more money than a bank teller or checkout chick, because the tools ARE easier, and sites like this one make it easier again.
Steve Pullan wrote: Part of the problem of such high level tools that make it easier I guess - and employers' expectations.
Yeah, it's both of those things. And for the record, I don't expect C# to be much different in a few years time. I still love C# though, especially with the C# 2.0 ( and 3.0 ) stuff that I've seen. There will always be people willing to hack code for $10 an hour, but the people who employ those folks will get the systems they deserve, and pay the price when we're called in to fix them. I know, I've done it on some VB/ASP.NET sites already.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Anyway thank you for you two's help!
i have just learned this for one and half months, i do need some help in certain field! if i really know how to manage all the objects and functions in VS.net , i also can solve the problem by myself. i am here becoz i need some experienced people to teach me new things andgive me some idea. if someone want to help i really appreciate it. VB.net is really like a designer, there is not many thinking things in it, once you have done something then you are able to do it! expirience is the key here. i put my problem here coz i have never seen this kind of problem then i need help and i want to develop my future on this. i won't use anyone else's code to make money for myself.
I am Entry level person
|
|
|
|
|
thank you anyway! i donot need someone to teach me a lesson! i just want to learn something through here! and i know you are very good but it does not mean you can judge person here! maybe i misunderstand you, but i just donot feel good since i am trying to learn here!
I am Entry level person
|
|
|
|