|
Very Thanks Brother.
God Bless You
Syed Shahid Hussain
|
|
|
|
|
HI,
I learned how to make events using delegates. And, to my understanding, all the events must be made using the control's existing prime events. i.e, If I want to trigger an event for a textbox whenever an user type 'A', i will have to use text_Changed event and check if the text == 'A'. But my question is, How can I create a prime event for a control. Is it the only way to use Timer with a very small timespan and check if the control's property changed and trigger event ?
I have an user control (HTML Editor Control) which doesn't have documentHTML_Changed event. I want to create this event and I did not find any supporting prime eevent to know when exactly the documentHTML property has been changed for that HTML editor. Thats why I was thinking what is the solution for creating this kind of event other than using TIMERs ? To me, TIMERs are the worst solution as they are always running and eating CPU resources for nothing.
Regards,
Emran
|
|
|
|
|
bashiwala wrote: I have an user control
If you create a user control you can add whatever events you want and raise them whenever you want. What's the problem?
|
|
|
|
|
Hello, Thanks for reply.
Say for example, web browser control has a property named DocumentText but it doesnot have any event DocumentText_Changed. Now, is there any way to know when the DocumentText has been changed other than using Timer and check every milli second if the DocumentText is not equal to the last value ..etc.. . If I have some supporting events, then I can make custom event based on the supporting event, right ? But I was wondering how to make the core event like TextChanged, EnableChanged, etc for a control which doesn't have these events defined !
Thanks again
Emran
|
|
|
|
|
Hello Emran
Sure there is a way of making your own events. In your custom class declare your public event like this:
public event HtmlDocumentChange OnHtmlDocumentChange;
HtmlDocumentChange is your handler's delegate.
Then you have to fire/raise the event by calling that delegate:
OnHtmlDocumentChange();
This is the very basic principle of events. The entire issue is when to know that the document has changed thus firing the event is specific to your contorl. If you are inheriting from WebBrowser control, you'd have to handle all events that might change the document -eg. Navigated, DocumentCompleted, DocumentTitleChanged, etc..-, then check the current document against the old one somehow. Depending on the changes you want to track you can store a backup copy of the current document in a private member to compare against, or just store the part you are tracking. When you sense a change in the document call the OnHtmlDocumentChange() delegate.
PS.
Using Timers is not bad.. It's disastrous way of firing event.
Regards
|
|
|
|
|
Is there a way to know where a browser is headed from a C# based application? i would like to be able to know what pages and files have been downloaded from a C# application, if there is a better way to do it using just the internet conection and not a browser that would be better. Please, help.
Victor Bello
you are what you research. VB
|
|
|
|
|
i've been trying some stuff, can anybody tell me how to use the SocketInformation.ProtocolInformation on C#? i can't get the socket to work.
VB
|
|
|
|
|
method #1: create a windows hooker to intercept the events of the browser
can be quite messy.
method #2: create a http sniffer (plenty of samples on this website)
|
|
|
|
|
Can you refer me to one, all ive found are programs or SDK you need to buy to create a sniffer, is there any other way to do it by myself?
Thanks, VB
|
|
|
|
|
Hello Everyone,
Does anyone know of a way to populate a TreeView with information from a table in a database and keep track of the unique identifier for that record? I can't really explain it well in words, but there are reasons why I cannot do a "SELECT WHERE XXX = 'e.Node.Text'" (off of the TreeView_AfterSelect. What I did at one point was actually store the file id's inside the treeview, enclosed in [ ]'s and did parsing to figure out which FILE_ID it was, and then I could pull up the information that way, but it looks ugly. e.g.
Parent
|
------- Child [1]
------- Child [2]
Where 1 and 2 are the unique key identifiers of that particular record in the database. I am just not sure how to go about linking a unique ID to every node in a TreeView without actually putting the ID right in the text for that particular node. I tried to populate an ArrayList with a structure that held the child's name and the ID for that child, and then iterate through the ArrayList when the treeview is clicked and find it ... but there can be duplicate entries in the database that have the same parent name and same child name.
So basically the question is, when working with a TreeView and populating it from a database where the only thing that you can be sure is unique is the ID unique key ... How to do track that key with each node to ensure that when you click on a node you are pulling the proper record out of the database?
Hopefully I made sense here. I rewrote this three times. I just can't really think of how to put this into words correctly.
|
|
|
|
|
Hi!
Each TreeViewNode has a property named Tag. This way you can assign an arbitrary object to each tree node.
Hope this helps.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Oh my! I read and read and read trying to find something like this. It is EXACTLY what I am looking for. I spent two days writing ArrayLists and all sorts of other stuff to try to keep track of the ID info!
Thanks a bunch for the response!!!!
|
|
|
|
|
for the following example str2 should be "dccc" but it is "dabcabcabc".
What's the problem?
class Program
{
static void Main(string[] args)
{
String str1 = "dabcabcabc";
String delim = "ab";
String str2 = str1.Trim(delim.ToCharArray());
Console.WriteLine("Delimiters: {0}", delim);
Console.WriteLine("Original string: {0}", str1);
Console.WriteLine("Trimmed string: {0}", str2);
Console.ReadKey();
}
}
modified 30-Nov-21 21:01pm.
|
|
|
|
|
You want Remove, not Trim. Trim removes from the edges, hence 'trim'.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
My bad
MSDN : String.Trim (Char[]) Removes all occurrences of a set of characters specified in an array from the beginning and end of this instance.
modified 30-Nov-21 21:01pm.
|
|
|
|
|
Hello
Try this instead:
class Program
{
static void Main(string[] args)
{
String str1 = "dabcabcabc";
String delim = "ab";
String str2 = str1.Replace(delim, "");
Console.WriteLine("Delimiters: {0}", delim);
Console.WriteLine("Original string: {0}", str1);
Console.WriteLine("Trimmed string: {0}", str2);
Console.ReadKey();
}
}
Regards
|
|
|
|
|
thanks ... that's what I wanted in the first place.
modified 30-Nov-21 21:01pm.
|
|
|
|
|
try using the split instead of the trim
|
|
|
|
|
was using C# to parse
if any one has prior experience.
|
|
|
|
|
|
What exactly is the question? I can't make anything useful of the two posts you created in this thread.
WM.
What about weapons of mass-construction?
|
|
|
|
|
Hi,
I know its last thing on a Friday but I hope someone can help.
I need to loop through every cell in a datagridview and make sure that each value is not null.
Looping through the cells isn't a problem (I don't think), I used a for loop with another nested inside, the inner loop taking care of the column index and the outer loop holding the row index.
What I can't do is check the contents of each cell as there is no suitable method in DataGridCell.
Please can anyone help?
Thanks
Scott
The loop code used if anyone is interested.
for (int i = 0; i <= rowCount; i++)
{
for (int j = 0; j <= colCount; j++)
{
DataGridCell dgc = new DataGridCell(i, j);
}
}
Scott
|
|
|
|
|
Are you looking for something like this...
grvMain.Rows[0].Cells[1].Text;
I hope this helps. I have worked quited a bit with gridviews so let me know if I misunderstood your question. If you have controls you are attempting to check in the cells it should look more like this...
((TextBox)GridView1.Rows[1].FindControl("txtProviderID")).Text.
Regards
|
|
|
|
|
I am trying to get data from the DataView in my form and put in a variable, preferably a string, that I can put manipulate and put into a document. My problem comes when I try to get the data from the DataView. Also, is there any way to configure settings so that users can only select the whole row, not individual cells?
-Fred
|
|
|
|
|
As far I can remember, in order to get a cell value you can use following snippet but please verify spellings with intellisense as I just typed from my memory.
string a = instanceDtataGridView.Columns["columnName"].SelectedRows[0].ToString();
To Select whole row, you can set the "Selection Mode" property of Datagrdiview, choose "Full Row Select". Again, I just typed the property name from my memory, you can find out easily about this property in the property editor of gridview.
Emran
|
|
|
|