|
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
|
|
|
|
|
I asked this a few days ago, but still haven't received a good answer.
How do I open an external application in a form? For example, I have a form called Form1. I want to run Foo.exe INSIDE OF Form 1. An answer to my previous quote understood it to be the equivalent of an IFrame in html. This sounds about right. But there's gotta be a way to do it in C#!!!
I know now that you can view .pdf's in a form, so it must be true you can open any application in a form...
Please help!
John
|
|
|
|
|
JohnBond311 wrote: I know now that you can view .pdf's in a form, so it must be true you can open any application in a form...
Not true at all. Some applications don't even have a user interface, to start with. Most applications have their own form, and you can't open a form in a form.
The application has to be created specially for being used as a component in a form.
---
b { font-weight: normal; }
|
|
|
|
|
JohnBond311 wrote: but still haven't received a good answer.
Perhaps, but you've probably received a 'right answer'. We don't change the laws of software here, we just report on them.
JohnBond311 wrote: so it must be true you can open any application in a form...
That's an astounding leap of faith. I know it's possible to buy real estate, therefore I should be able to buy the Grand Canyon. That's what you just said.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
JohnBond311 wrote: I know now that you can view .pdf's in a form, so it must be true you can open any application in a form...
No, the reason you can view a pdf in annother app is because Adobe wrote a pdf reader COM component and that component was then embedded into the application. The PDF viewing is not due to the stand alone acrobat reader being embedded.
|
|
|
|