|
Try using a DataView with RowFilter.
So something like
dim dv as DataView = Me.DsAddComponetAndEquipment.OrderDetails.DefaultView
dv.RowFilter = "columnname = 'somedata'"
Once you have set the rowFilter you will only see the datarowview that match that filter. You would need to set the rowfilter back to "" to get all rows again.
Hope that helps.
Ben
|
|
|
|
|
I am using Visual Basic to make a website and I want a user to be able to enter things in a Textbox and have that information put into access. I am using a Inset statement but it does not work. I am useing:
INSERT INTO Results
(Application_contact)
VALUES (AC.[text])
And it does not work does anyone have any ideas how i can have the textbox information put into a access?? PLEASE HELP!!
|
|
|
|
|
Ronak085 wrote: INSERT INTO Results
(Application_contact)
VALUES (AC.[text])
What is AC, and how are you using this code, in Access ? What does 'does not work' mean ? Does it compile ? What does it do ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
AC.text is a textbox that a user can input information and I would like that information to be put into a access database.
|
|
|
|
|
Am i correct in thinking Application_contact is a field name and AC.[text] is the text within a textbox named AC?
If i am correct then the SQL code is wrong. This part
Ronak085 wrote: VALUES (AC.[text])
will do nothing. For example if you wanted to insert the text 'AC.[text]' then the code would need to look like:
VALUES ('AC.[text]') (note a string literal must be enclosed '')
if AC.[text] is a variable (which i think it is) it needs to be:
VALUES ( '" & AC.[text] & "')
string variables must be enclosed '" & & "'
Numerics are " & & "
and with Access dates are #" & & "#
#EDIT#
And before anyone else nags me about it.
I know parameterized queries are better.
Jon
|
|
|
|
|
Since AC is the text box name and i want to convert what the user inputs into the text box to be brought to the access database. None of the follow work for me.
|
|
|
|
|
you should try AC.value, i programming in vba of access 2003 and i haven't access to control.text except if he has focus, i use value property to get text from text field.
|
|
|
|
|
In excel, I have listboxes (validation) in column A, and columb B. The ones in A work. I wrote code to check to see when there's a change in any item in A, and if the user hit 'No' on the MsgBox, then the change would be 'Undone' (ie. managed to use Undo in VB code).
My problem is, I'm using virtually the same code for column B. However, columb B's list items are a validated list depending on what was selected in A. Whenever a change is made in B, and the user hits no, Undo is NOT executed. Any ideas as to why this is happening? Here's a sample of the code that is working for A: (Note that the code I have for B is the exact same with different Range references)
'''Code start''''
Public undoCheck As Boolean
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If undoCheck Then
'do nothing
undoCheck = False
Else
Dim i As Integer
Dim rowNum As Integer
i = 10
While i < 85
If (Target.Address = "$A$" & i) And (Cells(i, 2).Value <> "" Or Cells(i, 3).Value <> "" Or Cells(i, 4).Value <> "" Or Cells(i, 5).Value <> "" Or Cells(i, 6).Value <> "" Or Cells(i, 7).Value <> "" Or Cells(i, 8).Value <> "") Then
If MsgBox("You are changing Element Data. Related Element Data will be removed but calculation data will remain. Do you wish to continue?", vbYesNo) = VbMsgBoxResult.vbYes Then
'clear values
Range("B" & i).Value = ""
Range("C" & i).Value = ""
Range("D" & i).Value = ""
Range("E" & i).Value = ""
Range("F" & i).Value = ""
Range("G" & i).Value = ""
Range("H" & i).Value = ""
Range("I" & i).Value = ""
'highlight colours
Range("C" & i).Interior.Color = vbYellow
Range("D" & i).Interior.Color = vbYellow
Range("E" & i).Interior.Color = vbYellow
Range("F" & i).Interior.Color = vbYellow
Range("G" & i).Interior.Color = vbYellow
Range("H" & i).Interior.Color = vbYellow
Range("I" & i).Interior.Color = vbYellow
undoCheck = False
Exit Sub
Else
undoCheck = True
If Application.CommandBars.FindControl(ID:=128).Enabled = True Then
Excel.Application.Undo
End If
Exit Sub
End If
End If
i = i + 1
Wend
End If
End Sub
''''Code end'''''
|
|
|
|
|
I have a program that I have written that uses its main form to show buttons which show the status of devices. These button have their own class (inherting the button class) and are run as their own threads and can update themselves as required.
What I want to do, is to make the form become the TopMost window when one of the buttons indicates an error condition. I can make the button threads modify a master variable of the form, and that works. But when I then also try to make the form TopMost (TopMost=True) (actioned by a button thread) is does not get remembered. E.G if a button thread calls the main forms subroutine :-
Public Sub attention()
SyncLock myObjLock
If need_attention = False Then
need_attention = True
TopMost = True
End If
End SyncLock
End Sub
need_attention gets updated to False but TopMost never happens. If I call this from the main form routines it seems to work, just not when a thread calls the routine.
I'm not sure if I'm missing something simple, hopefully I am.
Please help
Thanks
Nigel
|
|
|
|
|
Have you set a breakpoint to make sure the TopMost call occurs ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
The TopMost call gets called and is set to true. But when I set a breakpoint further on when something else happens and I look at the TopMost value, it is False and so the setting is never held. I never set it back to False so it can't be holding its value (well its not being set properly I guess).
Its confusing !!!
Nigel
|
|
|
|
|
Well, it works and it sticks. The only three things that can change that are:
1: You change it back to False.
2: You create a new instance of your form somewhere along the way and assign it to the same variable, thus giving the appearance that it didn't stick.
3: Some other form set TopMost to True somewhere else in your app.
|
|
|
|
|
|
uk_nbb wrote: and are run as their own threads
I am not sure what you are saying here, are you having some other thread create
and handle a Button ?
All Controls require they be touched only by the thread that created them,
which in practice means everything gets created and touched by the main thread
(aka GUI thread only), since thats where your first Form gets created, and normally
everything in one way or another connects to it.
There are a few properties/methods that dont have to obey this rule; mainly
InvokeRequired and Invoke() and its exactly these that you must use to
let another thread do something to a Control it did not create.
If you dont follow the rules here, on old .NET (prior to 2.0) it may or
may not work, typically it will suddenly ignore you or freeze, show a white
menu bar, things like that. Since 2.0 it will throw an InvalidOperationException
except when you have set CheckForIllegalCrossThreadCalls=false, which is
considered bad practice and brings you back to the 1.x behavior.
Hope this helps.
|
|
|
|
|
I think Invoke() may be my missing link.
I will read all about it and have a go.
Thanks
Nigel
|
|
|
|
|
i want to make a textbox that would only accept numbers as an input...
can you please give me sample codes. thanx!
i am using vb.net 2002 (desktop application)
|
|
|
|
|
i already got the answer to my own question... in case somebody else will need it
here's what to do:
--put the following code in the Key_Press event of the textbox control.
If e.KeyChar.IsNumber(e.KeyChar) = False Then
e.Handled = True
End If
--then that's it! it would only accept numbers!
|
|
|
|
|
One update.
e.Handled = Not (Char.IsNumber(e.KeyChar) or Char.IsControl(e.KeyChar))
I have shuffled the code a little, but either way, the core thing is that you check Char.IsControl, otherwise things like backspace will not work.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
youre right! i didnt check that! thanx!
|
|
|
|
|
Hello,
I have written some reports in Crystal Reports XI Release 2 and calling them from VB.Net (2.0) application. Application resides on server and all clients (more than 300 machines) access/run it over the network.
Is there any way to deploy crystal reports on the server and all clients can be able run it or I have to install CR component on each client computer.
I am having the same problem with DSOFrammer control.
Your help will be highly appreciated.
Regards
Nas
|
|
|
|
|
|
Hello Ben,
Many thanks for your instant reply. You mean after installing this crystal reports server control on the server, I dont need to install anything on client machine in order to view reports within vb.net application?
|
|
|
|
|
Unfortunatly no. If you application is running the crystal report on the client PC, then it will also need to be installed on each client machine.
In my use of crystal reports I have a middle tier web service that actually creates the crystal reports then sends a word doc down to the client. So in that case since I am only running crystal reports in that middle tier web service, the report files and the install only need to exist on that web server.
In your case the report files and the crystal install will need to be installed on the client. Which is kind of a pain.
Ben
|
|
|
|
|
Many thanks Ben for your brief answer. I had a feeling that we gonna end up installing crystal reports on each client machine but wanted to check if someone has cheated crystal reports for this problem.
Anyways I appreciate your prompt responses.
Nas
|
|
|
|
|
Note, the link I provided in the above post is not a full version of crystal it is just what is needed to run the reports.
Ben
|
|
|
|