|
Hi, and thanks for your interest. I have some databound textboxes that are grouped on a number of pages in a tabcontrol. I use a button to call up a dialog box to pull data from a lookup table to speed populating some of the textboxes on the tab control. Updates seem to work fine untill I add some additional code in the Update event to check for null conditions. Then it gets strange, after I fill the textboxes from the lookup dialog I have to click in one (doesn't seem to matter which) of the filled textboxes for the updated information to be posted to the database. I have no code associated with tabcontrol or textbox mouse events on the form.
Code To Open Dialog (Form1)========================================
private void btnLmoLookup_Click(object sender, System.EventArgs e)
{
Form2 LmoLookup = new Form2();
LmoLookup.StartPosition = FormStartPosition.CenterParent;
if( LmoLookup.ShowDialog() == DialogResult.OK )
{
txtBoxDocName.Text = LmoLookup.docFullName;
}
LmoLookup.Dispose();
}
Code To Declare Public Variable (Form2)==================================
public string docFullName
{
get{return this.dsExtPhysLookup1.Tables["tblExternalPhysicians"].Rows[this.listBox1.SelectedIndex]["docFullName"].ToString();}
}
Code To Perform Update (Form1)===========================================
if(this.txtBoxDocName.Text.Trim().Length == 0) {
this.dsPatientIndex1.Tables["tblPatientIndex"].Rows[this.BindingContext[dsPatientIndex1, "tblPatientIndex"].Position]["patientRefDName"] = DBNull.Value;
}
else
{
this.dsPatientIndex1.Tables["tblPatientIndex"].Rows[this.BindingContext[dsPatientIndex1, "tblPatientIndex"].Position]["patientRefDName"] = txtBoxDocName.Text.Trim();
}
this.BindingContext[this.dsPatientIndex1, "tblPatientIndex"].EndCurrentEdit();
this.sqlDataAdapter2.Update(this.dsPatientIndex1);
-- modified at 8:53 Friday 7th October, 2005
|
|
|
|
|
I am going to write an application that will be controlling hardware through two RS-232 ports. The code that drives each port will be doing the exact same thing, but the actions will be totally independent of one another. What I need to determine is how to make the code run simualtaneously for each COM port, but independent of the other. My plan is to have a GUI the has two frames on the screen. In the left frame will be the code that interfaces with port COM1 and in the right frame will be the code that interfaces with port COM2. These will be asynchronous events and will basically be running independent of one another except that a signle application will encapsulate all of th code.
Overall, the theory behind what I am doing is pretty easy and I have a lot of experience wirting drivers for hardware, but I need to have mulitple instances running simultaneously in a single application. That is the part I have no expeience and am stuggling with. Any advice, links to tutorials,code ex., etc would be a great help.
In a nut shell, I want to be able to take a single application to operate some hardware, then be able to run it two, there, four, even more times within the same application at the same time.
Terry Jones
|
|
|
|
|
Put the rs232 code into a thread, and run 2+ seperate instances of it.
|
|
|
|
|
You should use .NET 2.0, it already contains all the code for interfacing with COM ports. .NET 1.1 does not provide this.
|
|
|
|
|
Hi all,
I am a Beginner to c#.
I Need to convert array of byte data type to string. How to do this..
ex:
byte[] bytes = new byte[1000];
this bytes get filled up. Now I need to convert to string.
How to do this..
|
|
|
|
|
Hello
You use the next code:
byte[] bytes = new byte[] { 0x41, 0x42, 0x43, 0x44, 0x45 };
string str = System.Text.Encoding.ASCII.GetString( bytes );
System.Diagnostics.Debug.WriteLine( str );
With best regards,
Andrew Kirillov, MCP x 3
Prize winner, August 2005
|
|
|
|
|
hi Kirillov,
Thanks a lot..
Worked and my problem is solved..
Have a nice day..
Shiva P
|
|
|
|
|
Can somebody point me to LDAP code for authenticating a user through LDAP or active directory.
Thanks in Advance.
Ramendra Kotharkar
Ramendra K
|
|
|
|
|
DirectoryEntry entry = new DirectoryEntry("LDAP://testdomain/DC=testdomain", "testdomain/" + textUser.Text, textPassword.Text);<br />
<br />
Object obj = entry.NativeObject;<br />
DirectorySearcher search = new DirectorySearcher(entry);<br />
search.Filter = "(SAMAccountName=" + textUser.Text + ")";<br />
search.PropertiesToLoad.Add("cn");<br />
SearchResult result = search.FindOne();<br />
<br />
if (null == result)<br />
{<br />
.<br />
.<br />
.<br />
}
This only works with AD, by the way: if you find that works with LDAP, please let me know
|
|
|
|
|
Hi
"%FrameworkSDKDir%\bin\resgen.exe" "$(ProjectDir)UserMessages.txt" "$(ProjectDir)UserMessages.resources"
I have added the above line in my post build event. It throws up a post build error.
(A tool returned an error code from the build event).
When i run the above command (replacing Project dir with directory path) from .net command prompt it works fine and returns the following message.
Read in 2 resources from 'c:\TestProject\UserMessages.txt'
Writing resource file... Done.
Thanks in advance.
|
|
|
|
|
Is there any wndows api or hook by which i can get application wide events in a windows application?
Please help me guys, i am stuck in a project.
Thanks in advance.
|
|
|
|
|
|
Hi
I was wondering if anyone could offer some advice on authenticating a .NET application with LDAP. The code seems to work fine with AD, but fails with LDAP. Also, I have a Java App that can do this just fine, but somehow the solution with .NET eludes me!
(extract)
DirectoryEntry entry = new DirectoryEntry("LDAP://testdomain/DC=testdomain", "testdomain/testuser", textPassword.Text);<br />
<br />
Object obj = entry.NativeObject;<br />
DirectorySearcher search = new DirectorySearcher(entry);<br />
search.Filter = "(SAMAccountName=testuser)";<br />
search.PropertiesToLoad.Add("cn");<br />
SearchResult result = search.FindOne();<br />
<br />
if (null == result)<br />
{<br />
.<br />
.<br />
.<br />
}
The test PC runs on a Windows XP box with .NET Framework 1.1, and is bound to whichever server we're testing on at the time.
The authentication server is a Mac OS X 10.4 server running LDAPv3 (I believe built on OpenLDAP, and should be similar in every way).
Any suggestions?
(or anyone with a Linux OpenLDAP domain out there?)
|
|
|
|
|
|
Thanks - have you perhaps got a link to it?
|
|
|
|
|
|
how to add an event 2 a graphics object?
|
|
|
|
|
Can you post an example of the code you are wishing to "add an event" for so we can see what it is yo're trying to do?
|
|
|
|
|
How do i get Application wide events in a windows application?
Thanks in advance.
|
|
|
|
|
We need to know a little bit more about what you are trying to do. You can create class specific events using event delegates. Is this what you are lookign for? If so, I'll post you some examples. If not, please elaborate on what it is you're trying to do.
|
|
|
|
|
Hi
How can I retrieve the terminal session id?
My code is as follows:
[DllImport ("User32.lib", CharSet = CharSet.Auto)]
private static extern Boolean GetSystemMetrics(int nIndex);
[DllImport ("Kernel32.lib", CharSet = CharSet.Auto)]
private static extern uint WTSGetActiveConsoleSessionId();
public static Boolean IsRemoteSession()
{
return GetSystemMetrics( SM_REMOTESESSION );
// Where can I get this SM_REMOTESESSION from?
}
public static uint GetSessionId()
{
return WTSGetActiveConsoleSessionId();
}
|
|
|
|
|
Hi!
Usually the easiest way to get the real definition for constants like SM_REMOTESESSION is to search through the header files in the platform sdk.
You can use VS.NET's search in files dialog:
search [VS.NET Installation Path]\Vc7\PlatformSDK\Include (including subdirectories) for *.h files containing the symbol and you'll find the definition.
In your case, it's defined in WinUser.h and its value is 0x1000.
Regards,
mav
|
|
|
|
|
Hi
Thanks. Then where can I get a list of functions in the wtsapi32.dll?
|
|
|
|
|
You can use DependencyWalker (http://www.dependencywalker.com/[^]) to get the function names in dlls, but without a description of what the functions do and which parameters they expect you won't get very far.
So the better choice is to read the documentation on MSDN.
Regards,
mav
|
|
|
|
|