|
MyBase.Click does NOT handle mouse clicks for the form and everything on it. It only handles the mouse clicks for whatever object MyBase is. There is nothing that handles mouse clicks for the form AND everything on it.
You'd have to specially write the code to attach the Click event for all your controls to the single handler that you're writing. See AddHandler for this. But, this is never recommended. There's actually a performance penalty for routing all the forms controls events through a single Click event handler. It makes for very messy code.
But, there are reasons for do it. For instance, a related group of buttons that all do essentially the same thing could have all their Click events routed to a single Click event handler. See the Handles clause for Event Handlers or the AddHandler and RemoveHandler methods.
Your code for determining object type is grossly convoluted. It works much simpler if you just did:
If TypeOf sender Is object Then
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
My access table has a date field stored as a string. In the select I want to return all records between a beginning and end date on that field. The variables defining starting and ending dates are date type variables.
So I'm trying to convert the table field to a date type in the SQL string. My select is shown below but it does not work when it executes.
The error message is:
"Data type mismatch in criteria expression."
myadapter.SelectCommand = New OleDbCommand("select * from table1 where cdate(ship_date) >= " + date1 + " and cdate(ship_date) <= " + date2, myconnection)
What is wrong?
Thanks for any help provided.
|
|
|
|
|
Are you using a strongly-typed DataSet ? If so, the problem may be with the DataAdapter getting a string when it expects a date for the ship_date column. Try listing the columns explicitly and casting dates appropriately. You should always list columns explicitly, anyway - it's a best practice.
I'm not really sure if this is the problem, tho. Just figured I'd throw it out there to help out.
Michael Flanakin
Web Log
|
|
|
|
|
Hi,
I have made a program that would monitor a directory and watch for file creation using File System Watcher. On the Changed event i basically transfer the file created and copy to another folder using File.Copy. It works fine with small file (less than 1 MB). But for large file the program throws an exception as follows:
System.IO.IOException: The process cannot access the file "D:\VB.Net Testing\dest\Gil Scott-Heron - Blaxploitation.mp3" because it is being used by another process.
where D:\VB.Net Testing\dest\ is the destination folder.
But when if i triggered the copy using something else like Button_Clicked, it just works fine. I guess the problem is with the File System Watcher.
Any way I can get around with this problem? Pls Help.
|
|
|
|
|
chiyinhk wrote: I guess the problem is with the File System Watcher.
No, it's with how your assuming it works.
The Created event fires when the fire is CREATED, not when it's finally full of data and the other app closes it.
Since the other application is still writing to the file, and most probably has an exclusive lock on it, you have to wait until the other process is finished with the file before you can copy it.
To do this, in the Created event, your code has to try to open the file for Exclusive Read (DenyShareAll). If the Open fails, you'll have to wait a couple of seconds, then try again. Keep doing this until the file opens.
When the file finally does open, you can either read the file and copy it yourself, or close the file, then immediately start the File.Copy just like you are now.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello!
When I locked the access datbase with password, I am not able to open it with the connection string defined below. Any idea why I can't open the
database with the password. I am not typing any wrong password.
When I take out this part (JET OLEDB: Database password=456ffa1;) I am able to process my unlocked database.
Public ConnStr As String = "Provider=Microsoft.jet.OleDB.4.0;Data source=" & Application.StartupPath & "\Database\lyrics.mdb;JET OLEDB: Database password=456ffa1;"
Thanks!
Bedri
|
|
|
|
|
|
I the code i define all the required parameter to connect to a sql server.
Also I define dataset in the code.
i need to bind rows in the dataset to a textbox using textbox binding propertise.
what code i must write in textbox -> properties -> bindingdata -> advance -> text to connect dataset that i define in the code to the textbox.
Thanks....
|
|
|
|
|
after filling the dataset with datatable
write this:
textbox1.text=ctype(dst.tables(0).rows(0).item("ColumnName"),string)
thats all
abhinav
|
|
|
|
|
It's as easy:
TextBox1.DataBindings.Add("Text", myDataSet.Table1, "myField")
vonb
|
|
|
|
|
I have Oracle DB Table with one of its column (VARCHAR). I read and write to
this data [non-english or English] using VC application then everything
works fine. But if I use a VB application to read the data[non-english] and
write it back to the same palce the content is corrupted.
Any help is appreciated
|
|
|
|
|
The problem is solved. It was due to the difference in the way, the Unicode characters are handled by "Oracle Provider for OLE DB" (OraOLEDB.DLL) and "Microsoft OLE DB Provider for Oracle" (msdaora.dll).
Refer : http://support.microsoft.com/kb/q244661/
My vb application was using msdaora.dll while VC++ was using OraOledb.dll !
Suhredayan
|
|
|
|
|
I need create interface in my application program like windows xp.
Pls. Send me *.OCX files to my mail kusal1@gmail.com
Kusal
|
|
|
|
|
Goggle[^]
Noone here is just going to send you stuff. We'll help you with your code, but your responsible for actually putting effort into searching for your solution first.
BTW, there are no OCX controls that will give the you look and feel of Office controls. You actually have to code it. But like I said, Google for it first. There are TONS of examples out there.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello everyone,I'm migrating the VB Engine to VB.NET. I manage to run the function only in the first time,it will occur this error>>"Exception has been thrown by the target of an invocation" when it start to continue running the second time by the time interval have been set. This Engine is set to run by time intervals. Anyone can help me to solve the problem?
And this is what the error I got:
************** Exception Text **************
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: The connection is already Open (state=Open).
at System.Data.SqlClient.SqlConnection.Open()
--- End of inner exception stack trace ---
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Microsoft.VisualBasic.CompilerServices.LateBinding.FastCall(Object o, MethodBase method, ParameterInfo[] Parameters, Object[] args, Type objType, IReflect objIReflect)
at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn)
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
at TT_Front.First.Distribution() in C:\Documents and Settings\Kam\My Documents\Visual Studio Projects\TT_Front\First.vb:line 165
at TT_Front.First.Timer1_Tick(Object sender, EventArgs e) in C:\Documents and Settings\Kam\My Documents\Visual Studio Projects\TT_Front\First.vb:line 146
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr idEvent, IntPtr dwTime)
Thank you so much,I can't really solve this problem because I'm still new to VB.NET. I wish someone really can help me in this. Thank you so much.
|
|
|
|
|
Noone is going to look at this post, simply because of it's size. Don't post your entire app, just the relevent code.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes,thank you for the advice. I have post up the error founded. Do you know what might be the problem occurred?
|
|
|
|
|
The error already told you exactly what is going wrong: System.InvalidOperationException: The connection is already Open (state=Open).
Read a little below that and you will find the error is comming from the class System.Data.SqlClient.SqlConnection with function Open(). So it looks to me you're trying to open a connect to a database when there already is an open connection.
|
|
|
|
|
Oh,thank you so much for helping me to solve this problem. I'm quite new to VB.Net,but feel so lucky U manage to help me. I solve this problem by rechecking all the connection open between my database and this Engine. Thank you so much Mr Gerben Jongerius.
Wish You and the others Have A Wonderful New Year~!
|
|
|
|
|
The rule for database connections is simple. Open the connection to the database as late as possible, execute your batch as quick as possible, then close your connection as early as possible. It's very bad practice to hold open a database connection for the life of your app.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank you so much for the information provide,I think I should learn more from you all in the future. Thats great you all really help me a lot on solving the problem. All the best and happy new year.
|
|
|
|
|
at LoadLibraryW(UInt16* )
at System.EnterpriseServices.Thunk.Security.Init()
at System.EnterpriseServices.Thunk.Security.SuspendImpersonation()
at System.EnterpriseServices.Platform.Initialize()
at System.EnterpriseServices.ResourcePool..ctor(TransactionEndDelegate cb)
at System.Data.SqlClient.ConnectionPool..ctor(DefaultPoolControl ctrl)
at System.Data.SqlClient.PoolManager.FindOrCreatePool(DefaultPoolControl ctrl
)
at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConn
ectionString options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()
at checkConn.Module1.Main()
I am getting the above error, when I try to open a connection with local MSDE 2000 database
can you help me?
Thank You
|
|
|
|
|
hi all,
i have a problem dealing with cascading style sheet.
how do i link my style sheet (placed background pic inside) to Default.aspx (example).
i want the picture to appear when i run Default.aspx
error occurs when i tried.
error message:-
Error 1=> Cannot switch views: Validation (XHTML 1.0 Transitional): Element 'link' cannot be nested within element 'html'.
where shall i put this link then?
link: thanks for the help..
-DarkangeL-
|
|
|
|
|
Put your <link> tag in the <head> section.
Michael Flanakin
Web Log
|
|
|
|
|
Gee..
thanks for your help..
it does solve my problem..
thank you once again.
-DarkangeL-
|
|
|
|