|
I don't think it can be done without human intervention. At best you could put the last element in the last name field and everything else in the first name field. Then review any first names that contain a SPACE.
|
|
|
|
|
PIEBALDconsult wrote: At best you could put the last element in the last name field and everything else in the first name field.
That would yield a lot of problems where I live, as:
1) a lot of last names consist of two or three words, such as
"Miel De Schepper" and "Jan van der Spiegel" (first names are Miel/Jan); here you should at least check for "de", "van der" and "van de" (all possible capitalizations) and when they occur they are part of the last name.
2) first names could be composite ("Jean-Paulus") and last names could be composite ("Paulus-Beeldens"); now what when one of them is composite, the hyphen is missing, and the middle word of three could be a second half of the first name, or the first half of the last name (say "Jean Paulus Beeldens")?
I am 100% sure there isn't an algorithm that solves the problem, and IMO the best fit algorithm is very region dependent.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Hi,
I am displaying Word Document using Web Browser, its working fine but i just want to show the text of that Word file. But currently its showing the Text as well the MenuBar on the top. Is there any way to hide the toolBar and so it only shows the Text ?
|
|
|
|
|
Hi
I have a form that has text boxes and combos bound to fields in an object. When the user is using the form they have the option to apply some default values to some of the fields. I was hoping that I would just have to either update the control with the value or just update the field in the object. When I update the field in the object, the form will not refresh with the new values until another field on the form is changed. If I update the control, the field in the object does not update.
My way around this was to update both like this
case "LOGCERT_LEVEL_":
logginCertCombo.SelectedValue = newValue;
staff.LogCert = newValue;
break;
To me that is a bit ugly
Is there a way to do this automatically? My controls are bound like this
logginCertCombo.DataBindings.Add("SelectedValue", staff, "LogCert");
I've tried google and today it is not being my friend.
Many Thanks
The FoZ
|
|
|
|
|
Sound like you want to look at the .BindingContext for your Form in order to get the BindingManagerBase (which will get you a Property Manager versus a CurrencyManager because it looks like you are binding to a single business object) so that you can use .PullData() and .PushData() to sync your controls and DataSource ...
|
|
|
|
|
Thanks for you reply Gerry, but I'm not sure how to get this working. I've looked up the Currency and Property Manager Classes and where the classes contain the Push and Pull methods they are not visible.
I created a private CurrencyManager myFormCurrencyManager for my form and added
myFormCurrencyManager = (CurrencyManager)this.BindingContext[staff] after I bound the controls. This caused an invalid cast exception so I changed it all to a PropertyManager still with no luck.
Am I missing something else? Do you know of any decent examples?
Cheers
The FoZ
|
|
|
|
|
Sorry about that; didn't realize those methods were protected.
Here is a solution that works: use the DataBindings ReadValue and WriteValue methods; eg.
<pre>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1 {
public partial class Form1 : Form {
private TextBox fistNameTextBox =
new TextBox() { Location = new Point( 0, 0 ) };
private TextBox lastNameTextBox =
new TextBox() { Location = new Point( 0, 30 ) };
private Button readButtom = new Button() {
Location = new Point( 0, 70 ),
AutoSize = true,
Text = "Read from Source"
};
private Person aPerson = new Person();
public Form1() {
readButtom.Click += new EventHandler( readButtom_Click );
fistNameTextBox.DataBindings.Add( new Binding( "Text", aPerson, "FirstName" ) );
lastNameTextBox.DataBindings.Add( new Binding( "Text", aPerson, "LastName" ) );
this.Controls.AddRange( new Control[] {
fistNameTextBox, lastNameTextBox, readButtom } );
}
void readButtom_Click( object sender, EventArgs e ) {
aPerson.FirstName = "John";
aPerson.LastName = "Smith";
foreach ( Control control in this.FindForm().Controls ) {
if ( control is TextBox && control.DataBindings.Count > 0 )
control.DataBindings[ 0 ].ReadValue();
}
}
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault( false );
Application.Run( new Form1() );
}
public class Person {
public string FirstName { get; set; }
public string LastName { get; set; }
}
}
}</pre>
|
|
|
|
|
Thanks Gerry.
The foreach loop was exactly the thing I was after
foreach ( Control control in this.FindForm().Controls )
{ if ( control is TextBox && control.DataBindings.Count > 0 )
control.DataBindings[ 0 ].ReadValue(); }
Cheers
The FoZ
|
|
|
|
|
Hi Everyone,
I have placed a sample code below in which i need to type cast from struct to list<object>. In this below example how i can add emp1 to operation list
public struct Operation
{
public bool success;
public string msg;
public List<Object> ListTest;
}
public struct Emp
{
public int EmpID;
public string EmpName;
}
public class Class1
{
public Class1()
{
//
// TODO: Add constructor logic here
//
}
public void Method1()
{
Emp emp1 = new Emp();
Operation op = new Operation();
emp1.EmpID = 1;
emp1.EmpName = "Manoj";
op.success = true;
op.msg = "pass";
op.ListTest.Add(emp1);
}
}
Regards,
Manowj
|
|
|
|
|
And your problem is?
Looking at it, you are getting a "object not set to an instance of an object" exception, I suspect. Try:
{
Emp emp1 = new Emp();
Operation op = new Operation();
op.ListText = new List<object>();
emp1.EmpID = 1;
emp1.EmpName = "Manoj";
op.success = true;
op.msg = "pass";
op.ListTest.Add(emp1);
}
Or, by preferance, convert it to a class and handle it's internals better yourself!
BTW: use <pre> and </pre> blocks to preserve your formatting in future. It isn't too bad with a tiny fragment like this, but later...
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hi,
Thanks for your response. how can this be converted to JSON using ExtJS, json serializer is not able to convert it.
Regards,
Manowj
modified on Thursday, November 5, 2009 7:14 AM
|
|
|
|
|
I wouldn't want to convert it to anorexic XML.
Edit your OP to correct the code, and reflect the JSON requirement - you may get a more helpful resonse.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hello,
I want to read and write in the notepad itself. I can write any text to notepad file but i can't able to read the text. Like if i have opened "sample.txt" file in notepad and i want to read the content of that file. Here is my sample code:
Process notePad = new Process();
notePad.StartInfo.FileName = "notepad.exe";
notePad.StartInfo.Arguments = "C:/Users/krinal/Desktop/1.txt";
notePad.StartInfo.UseShellExecute = false;
notePad.StartInfo.RedirectStandardOutput = true;
notePad.StartInfo.RedirectStandardInput = true;
notePad.Start();
notePad.WaitForInputIdle();
notepadhandle = notePad.MainWindowHandle;
//write text to notepad
SetForegroundWindow(notePad.MainWindowHandle);
SendKeys.SendWait("Testing");
using sendkeys() we can write to notepad, is there anything for reading?
Please help me out.
Thank you in advance.
|
|
|
|
|
Try to find the child window whose text you want (by using for example Spy++).
After that use:
int GetWindowText(HWND hWnd, LPTSTR lpString, int nMaxCount);
If this fails, you need to attach your main thread to the notepad ones.
Greetings
Covean
|
|
|
|
|
Thank you,
I understand GetWindowText() method but what child window means?
Actually i am developing Text_To_Speech application, need to read notepad content text.
So i think my child window will be notepad. And i get content of notepad and use them from my application.
|
|
|
|
|
The main wnd is the full window with titlebar, menu, statusbar and so on.
But you need the text from the child edit window.
On my system notepad has the following windows (used spy++):
+ Window 000C0B3E "Unbekannt - Editor" Notepad
|--- Window 001D0848 "" Edit <--- thats the window with the text you want
|--- Window 00140B54 "" msctls_statusbar32
Greetings
Covean
|
|
|
|
|
|
Dear friends,
i have done a sample for modifing the "summary information" using dso file.
where i use two dll's "dsofile.dll" and "Interop.Dsofile.dll"
the "dsofile.dll" i have registerd using regsvr32 in command
and the second "Interop.Dsofile.dll" added as refrence in assambly and written some code using classe of the dll.
my doubt is
1.what is the diffrence of these two dll?
2.is it possible to Use the "dsofile.dll" in .net code (i am sure it not possible to add refrence as assably) any other way? and how
please give me some explation.
thank U
joe.I
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:22am.
|
|
|
|
|
Dear frined,
thanks for your replay.
and i have few more questions..
1.how to use COM dll in .net code?
is it like
using System.Runtime.InteropServices;
[DllImport()]
public static extern int Methodname(Arguments);
(if not what is the above dll import code used for)
2.is it possible to use all the windows dlls and other dlls in .net if the methods are exposed?
Thank you.
joe.I
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:22am.
|
|
|
|
|
Dear friend.
Thank You again....
what about the question is it possible to add all the dll?
if i add like "mshtml.dll" which is in "c:\WINDOWS\system32" it says
"please check wethere the dll is valid assambly or a com component"
is it possible to import the dll as unmanaged dll?
thank You
joe.I
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:21am.
|
|
|
|
|
Dear friend.
thank you for Your reply.
that was good solution for my problem ..... because i was adding another dll called "microsoft.mshtml" which took size of 7MB..
and
stancrm wrote: SHDocVw.dll do not have windowStateChange event
but if i refer "microsoft.mshtml.dll" i get windowStateChange event. how to go about?
and i take for granted that it is not possible to add all the dll in .net (dll are diffrent 1.com dll 2.net dll and 3 system dll) is it correct?
By
I.Joe
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:21am.
|
|
|
|