|
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.
|
|
|
|
|
Thank you ... thanks for replay...
|
|
|
|
|
Although Microsoft chose to have the same extension for these files, there are different "flavors" of dll files.
1. Native dll that has exported funtions - Use DllImport attribute to use functions in these dlls
2. COM dll (aka ActiveX dll) - Use 'add reference' dialog to add reference to these dlls - The VS IDE silently creates a RCW (Runtime Callable Wrapper), that is essentially a .NET Assembly that makes it easy to use your COM dll. This is what has happend in your case (Interop.Dsofile.dll is the RCW for dsofile.dll - you need both files for your app to run).
3. Managed dll (aka .NET Assembly) - These are created by .NET compilers and can be used directly from .NET clients. They can also be used by COM clients using CCW (COM Callable Wrappers).
Uhhh!!! Quite complex, isn't it ?
|
|
|
|
|
Thank You Shameel...
is all the dll in system32 are native dll
Shameel wrote: Native dll that has exported funtions
(somehow windows should exported funtions to use there allplication to use)
if it so then it is possible to use all those dll.. get the work done .
am i right.
By
Joe.I
|
|
|
|
|
Dear All,
I have a combo box which get its data from SQL data source.
I need to add one row to the columns got from this Sql Data source at run time.
How can I do this?
Kind Regards
OBarahmeh
|
|
|
|
|
Hi there... I need some help with putting data in a ListView from a list of objects (List<object>).
It's a rather complex list I have, because the objects in my list itself contains list of objects in many levels.
I'll try to simplify the list:
Let's say we have the following list of objects:
List<x> -> where X contains "A", "B", "C" and "List<y>"
List<y> -> contains "D", "E", "F" and "List<z>"
List<z> -> contains "G", "H", "I".
The list is placed in one project called Control, in class controller.cs
In another project called View, in class myForm.cs I have a ListView.
View has reference to Control, so myForm.cs will be "calling" controller.cs
Now to my problem: I would like to bind (object- or data-bind) my ListView to the List<x>, so that the ListView will list the "A's", "E's" and "I's" for all X-objects in the list.
Furthermore, if the user change data in the ListView, it should also change in the List<x>.
AND, if the user add a new row in the ListView with new data (A, E and I) the List<x> should contain a new X-object with the "A", "E" and "I" data.
For this example the other properties could just be empty (null) or whatever.
I've searched the net for a solution, without luck. All I find is something like binding datatables to ListView.
Someone here who can help me with this?
Just for the record, I have very little experience with bindings, so be gentle
|
|
|
|
|
The Listview does not support databinding natively although there are a number of work around examples[^].
Your design sucks if you are allowing the user to edit the data in a list control (Listview or grid). The management of the control and the list and the events associated with editing is a PITA.
I suggest you pop a dialog for the user to edit into and deal with the dialogresult to reload the list.
|
|
|
|
|
You are right. I'm using DataGridView now.... much better
But I ran into a new problem
On a form I have a ComboBox binded with List<x>, so that the ComboBox views the "Name" of the X-objects. Works fine
But for the selected X-object i ComboBox, I want to view the X's Y-objects (List<y>) in a DataGridView.
But I can't find a way to bind the ComboBox and DataGridView together.
|
|
|
|