|
Hi,
I have a form on which there is a textbox and a datagrid. Both the text box and datagrid are bound to some data sources. There are only two columns in the datagrid. The text box basically displays a column of the datagrid. When the user clicks on the New or Modify button, he is able to edit the value in the text box or add a new one which is added to the bound grid. But the problem is that the Text property of the text box becomes equal to empty string before it is added to the database or the grid. I have checked the source code many time but i dont know why it happens. I have faced the same problem previously but at that time, it became equal to empty string when AcceptChanges() method of the datatable was called. Any kind of help or suggestion please...
Regards,
Wasif Ehsan.
|
|
|
|
|
i'm sorry I really don't know about this.
|
|
|
|
|
Put a Chatroom in your site easily and free!
Doesn't requiere other apps runing on server. Very simple to implement.
It uses the same ISS as the chat server so you don't need to run other apps. The client is your web browser. Very easy to implement and to expand to build on. And free!:
http://www.spilafis.com.ar/ChatAjaxNet.aspx[^]
spilafis
http://www.spilafis.com.ar
-- modified at 1:08 Saturday 22nd April, 2006
|
|
|
|
|
Nice idea, just a pity it locks up IE... and with free, does it include full source too? If so, why not post an article?
|
|
|
|
|
is there a way to utilize media encoder and make a new video comprised from segments of the same video - encoder should run 'behind the scenes. i'm having trouble loading the profile for encoder as well as getting encoder to accept a session... thanks
|
|
|
|
|
I'm developing software for a class that takes a video and records instances of that video using time stamps. I was wondering how to create individule files of those instances from those time stamps. thanks.
|
|
|
|
|
Background:
I have Access 2003 installedand the database I'm trying to connect to via C# was probably created using Access 97. I don't have the option to upgrade the database and must remain in Access 97 format. The database is protected by a workgroup ID. The command line option for spawning the database is:
MSACCESS.EXE c:\master.mdb /wrkgrp c:\master.mdw /user foo /pwd bar
This brings up the database, but I get an error stating:
You can't make changes to the database objects in the database 'master.' This database was created in an eariler version of Microsoft Office Access....
Problem 1: Read-only connection
If I try and connect to this database from c#, I get the following error.
System.Data.OleDb.OleDBException: Cannot start your application. The workgroup information file is missing or opened exclusively by another user.
Since I can open the database using the command line above, I suspect in order to read the database, I need to somehow specify read-only access within the connection string. Here's my connection string:
String conStr =
"PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\master.mdb;SystemDB=C:\\master.mdw;User Id=foo;Password=bar;";
Problem 2: Actually altering the data
Is there a way to modify this database without either upgrading the database or downgrading my access application?
Code Cowboy
|
|
|
|
|
Hi,
im searching for Methods to compare Images. But i dont want only such simple things like comparing files byte for byte. I want to find pictures that are nearly same.
I have many pictures that have sequences of similar images eg. a series of images that show the same scene but someone moves around a bit or moves an arm up and down. So i want to do some checking for pictures that are not completely the same.
How can i do that or where can i find components that does that?
|
|
|
|
|
Hi.
There is a very interesting article here on CodeProject: The "Motion Detection Algorithm" which you can find here[^]. This might help you alot!
|
|
|
|
|
I have a text file with rows of lines that look like this:
44490825;4;05;00000004;Mike
I would like to know if there is way for me to read the values between the delimiters, which are the semicolons. I know that I can read one character at a time, but that means that I have to add each character to an array slot. I am hoping to be able to read from the beginning of the line to the first semicolon, add that string to an ArrayList, read the next value between the semicolons, add that value to the ArrayList, and so on until I reach the end of the line. I would really appreciate any help, thanks.
|
|
|
|
|
|
Use the Split method to split the string on ';', and you get an array of strings, where each item is a value.
---
b { font-weight: normal; }
|
|
|
|
|
hi Kani
I think you should use string.Split() method there.
Your issue can be solved with following line of code.
<br />
string text = "44490825;4;05;00000004;Mike"<br />
string[] items = text.Split(new char[]{';'});<br />
the Array items will hold each string in ';' as each array element.
So try this out Kani
My small attempt...
|
|
|
|
|
I have some applications that currently use a list control to display status messages from the process. As time goes by, the number of messages in the list would grow without bounds if I did not limit it. I do this by checking if adding a new message will make the line count go over the configured maximum. If so, I delete the first line in the control and then add my new line. There is no real need for the user to interact with the list other than to read it, possibly using the scroll bar. The list control has one column, wide enough for a reasonable length message.
The difficulty with this is that it causes a lot of flashing of the control, whether or not I ensure that the newly added line is visible. If messages are rapidly being added to the list, the list can go completely blank for periods of time while tons of updating is going on.
So what is a better way? I'm open to anything, particularly to using something other than a list control. Essentially, I'm trying to mimic how a read-only command prompt window works. Once it gets a certain number of lines in it, new lines cause old lines to disappear, with no annoying flicker.
Thanks in advance.
|
|
|
|
|
You may want to envelope your calls to add an item (and remove the first item when the list control is full) between a pair of SuspendLayout() and ResumeLayout() calls.
To further increase performance, you may want to consider deleting the first n items (and not just the first item) when the list control is full.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Hi All,
Since my last post on Design Patterns, I've been reading up on them and in particular the Observer Pattern, as I think it's the right tool for my specific task.
My scenario is this: I have a small(ish) application which uses a barcode scanner to read barcodes (naturally). Various parts (forms) of the application need to be able to accept the data from the barcode scanner (although not all at once, which I manage on a focus basis). To this end, I created a BarcodeScanner class as a Singleton, so that only one instance exists and so that it has public visability; I also created an event in this class so that it can notify any listeners when a Barcode has been successfully read. Each form that needs to read barcodes simply attaches itself as an Event receiver and so can listen (observe) the barcode scanner class.
And this all works pretty well, which is the important thing. But what I'd like to know is, is this an example of the Observer pattern as implemented in C#? Most of the articles I've read on the subject are great at explaining the abstract concept, but rely on the reader's intelligence ( ) to work out the implementation details for themselves.
Cheers,
Martin.
|
|
|
|
|
Utini wrote: is this an example of the Observer pattern as implemented in C#?
Yes, it is. A few points that may be worth mentioning:- Observers can attach themselves by chaining a listening delegate to
BarcodeScanner or implementing an IBarcodeScannerListener interface and attaching themselves by calling an BarcodeScanner.addListener() method. Delegates offer more flexibility in that the observer can supply any (valid) listening method at run time. I find the latter method meets my needs as it clearly indicates that a class is an observer of BarcodeScanner events.
- As with any listener, you need to be careful of cross thread calls (if
BarcodeScanner is running in a separate thread). See the doc on BeginInvoke() and EndInvoke() for more information.
- Because listeners will typically block execution of
BarcodeScanner , you should ensure that the listener method is lightweight. /ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Many thanks for that, ravi
|
|
|
|
|
I need help with a strange problem.
Symptom: my C# application crashes with a AccessViolationException. The interesting thing is that it happens only when running as 32bit-process on 64-bit Windows. Running 32bit on 32bit works fine, so does 64bit on 64bit.
FxCop does not complain about my P/Invoke declarations, so I don't think I confused IntPtr and int parameters - it runs fine both as 32bit process and 64bit process - just not as 32 bit process on Windows XP Professional x64 Edition.
Using the managed debug assistent in VS05, I get the error message "The runtime has encountered a fatal error. The address of the error was at 0x79fccc04, on thread 0x6c8. The error code is 0xc0000005.".
The line where it's failing is "return CallNextHookEx(...);", the callstack suggests it fails while/after calling CallNextHookEx; not when returning from my own hook procedure. What makes this really interesting is that the code using the hook is working fine until the text-editor portion of the app is activated. It crashes when the hook receives the message caused by activating the IME (input method editor; for asian languages).
Here is the P/Invoke declaration for the hook (I'm creating the hook with code=WH_CALLWNDPROCRET, hInstance=IntPtr.Zero and threadID=AppDomain.GetCurrentThreadId()):
internal delegate IntPtr HookProc(int code, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll")]
internal static extern IntPtr SetWindowsHookEx(HookType code, HookProc func, IntPtr hInstance, int threadID);
[DllImport("user32.dll")]
internal static extern int UnhookWindowsHookEx(IntPtr hhook);
[DllImport("user32.dll")]
internal static extern IntPtr CallNextHookEx(IntPtr hhook, int code, IntPtr wParam, IntPtr lParam);
CallNextHookEx[^] definition from MSDN:
LRESULT CallNextHookEx(HHOOK hhk, int nCode, WPARAM wParam, LPARAM lParam);
And here is the P/Invoke declaration for the IME:
private const int WM_IME_CONTROL = 0x0283;
[DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, [In, MarshalAs(UnmanagedType.LPStruct)] LOGFONT lParam);
[ StructLayout(LayoutKind.Sequential) ]
private class LOGFONT
{
public int lfHeight = 0;
public int lfWidth = 0;
public int lfEscapement = 0;
public int lfOrientation = 0;
public int lfWeight = 0;
public byte lfItalic = 0;
public byte lfUnderline = 0;
public byte lfStrikeOut = 0;
public byte lfCharSet = 0;
public byte lfOutPrecision = 0;
public byte lfClipPrecision = 0;
public byte lfQuality = 0;
public byte lfPitchAndFamily = 0;
[ MarshalAs(UnmanagedType.ByValTStr, SizeConst=32) ] public string lfFaceName = null;
}
So, how could I find what the problem is? Are there any other tools for checking such problems? I don't have any idea what can I do now. We need to run as 32bit on 64bit Windows because a library used by another part of the app is available for 32bit only.
|
|
|
|
|
You are trying to invoke a 64-bit dll in a 32-bit world.
|
|
|
|
|
What 64-bit dll?
I think I should add that I don't even have an IME installed - just some users of our software have.
All P/Invoke calls are from user32.dll - it uses the 32bit version of that dll. When disabling the IME call (I personally don't need an IME, only some users do), everything works fine.
|
|
|
|
|
Hey guys, I have a problem with DataGridView !!!
I have a DataGrid that is binded to a DataSet (MyDS)
and I have some Text boxes that are also binded to the DataSet(Using the below comand), so when I click on any rows in my DataGrid, the data is shown in my text Boxes.
dataGrid1.SetDataBinding(myDS, TableName);
It works perfectly.
Now I want to do the same thing with DataGridView, but it doesn't have that command, and i'm stuck !!! I 've been working on it for days but NO LUCK !!!!!!!
Can you please give m a hand ?!
Thanx
Mr.K
|
|
|
|
|
When using WinForms databinding in .NET 2.0, it is recommended to use the new BindingSource[^] component. All of the databound controls on a form should bind to that component. It works very well with the DataGridView as well.
Josh
|
|
|
|
|
For example, if a user clicks a file highlighting it, or drag selects multiple files, and they did this on the deskop or anywhere in some drive folder, then is their an api or something in .net that can help me figure out the file/s that were selected?
|
|
|
|
|
I'm not sure what you're doing exactly, but if you had the users select files through an OpenFileDialog, then you would have easy access to the file names.
|
|
|
|