|
I can usually muddle my way through creating a regular expression but this one has me stumped (even with Expresso). I need to search through the contents of a text box and find each word in an HTML doc, but avoid the text within the tags. I have a Regex that works fine in a plain text file, but not in a doc with tags.
Example: <li>List Item</li>
I'd want to find "List" and "Item" but not "li" or "/li"
If anyone has a Regex pattern that does this I'd love to see it, with thanks.
|
|
|
|
|
Alan, try this. The code originally came from the netSpell library, so i'm not 100% it works correctly...
Private _htmlRegex As Regex = New Regex("</[c-g\d]+>|</[i-o\d]+>|</[a\d]+>|</[q-z\d]+>|<[cg]+[^>]*>|<[i-o]+[^>]*>|<[q-z]+[^>]*>|<[a]+[^>]*>|<(\[^\]*\|'[^']*'|[^'\>])*>", RegexOptions.IgnoreCase Or RegexOptions.Compiled)
"An eye for an eye only ends up making the whole world blind"
|
|
|
|
|
Just ran it thru Expresso. It actually finds the tags, not the text between them. I have a Regex for stripping html, but I think this one might work better. So I can still use it. Thanks!
Hadn't thought about it before but I've got a copy of NetSpell somewhere. I'll poke around inside and see what I can see.
AB
|
|
|
|
|
Didn't find a Regex I could adapt in the NetSpell files. Will keep hammering on the thing. I keep thinking I'm missing something obvious but don't know yet what it is.
|
|
|
|
|
Hi All!
Please help, How to create DropDownButton in WindowsForms application?
I do not want to use ToolStripBar with ToolStripDropDownButton. I would inherit from class Button but what is the best way to implement drop down functional?
Thank you!
|
|
|
|
|
Suggestion:
Using most any paint program, create a very small arrow similar to the one in most drop down buttons. Create it pointing down and save it, then flip it vertically and save it again under a different name. Now you have your up and down arrows for the button.
Drag a regular button onto your form and set the text. Add the down arrow, aligned to the right of the text.
Create a ContextMenuStrip for the button and add the desired items.
Write code so that when the button is clicked once, the button's image changes to the up arrow, and the context menu appears below the button. Next time it's clicked, reset the button image back to the down arrow and close the context menu. You can monitor the button's "state" with a boolean variable and the menu's Visible property.
Also, add a line of code to each event handler in the context menu so that the button's image changes back to the down arrow when a menu item is clicked - since the menu will close.
Not a perfect solution, but I did something similar with ActionScript a few years ago and it worked quite well.
Best
AB
|
|
|
|
|
I have a application that has 2 tabs, one tab is wired to show a web page whose .aspx file has auto refresh set. The other tab doesn't access the web page at all. When I access any of the tabs I see that the web page is refreshing(hear the clicking sound), instead I want to disable the web page refresh whenever I access the 2nd tab. I set the "AllowNavigation" property of the webbrowser control to false when tab is switched to the 2nd one and set this property to true when I switch the tab to the 1st one.
But what happens is when I switch back to the 1st tab the auto refresh doesn't work unless and until I click some web page controls. Is there a way to enable/disable auto refresh of a web browser control from Win forms?
|
|
|
|
|
Member 3365607 wrote: But what happens is when I switch back to the 1st tab the auto refresh doesn't work unless and until I click some web page controls.
And if you navigate to, say, Google when you hide the browser, and navigate back to the .aspx when you show it?
Another alternative would be to download the webpage and to save it directly to a string/a file. Then you could manipulate the webpage before displaying it in the browser. That way you can change any meta-refresh tags before feeding it to the browser
I are Troll
|
|
|
|
|
Thanks Eddy. I will try that. Looks like the web browser control cannot control the auto refresh of .aspx.
I couldn't get ur question : And if you navigate to, say, Google when you hide the browser, and navigate back to the .aspx when you show it?
|
|
|
|
|
Member 3365607 wrote: And if you navigate to, say, Google when you hide the browser, and navigate back to the .aspx when you show it?
You could let the WebBrowser navigate to another site (Google only as an example) when you switch to tab 2. When the user switches back to tab 1, navigate to the original .aspx page again. That at least prevents the clicking-sounds of the refresh
I are Troll
|
|
|
|
|
Hi,
This is Siddhardh, beginner in using VC# and ADO.Net. Here i am creating a project for Medical Vaccines. I have created a form, which consists of out going products or Selling Goods to the customers. After Submitting the details, the data has been saved to the relevent Tables(SALESDATA and SALES), at the same time, i need to generate the bill for the current Invoice Number after submitting the data to the SQL Tables. So pls help me to code for this.
Thanks in advance.
Regards,
Siddhardh.
|
|
|
|
|
siddhardh wrote: i need to generate the bill for the current Invoice Number
Define what you mean, what is a bill?
|
|
|
|
|
is there any way of getting the cell location on a mouse over the table given no controls are present in the actual cells?
thanks you.
|
|
|
|
|
I'm developing an application where I need a context highlight edit control (single line and multi-line).
I need to be able to use my own tags (words/ID to be highlighted) and colors... and optionally tooltips for the highlighted words.
The control need to be fast and able to handle hundrets of tags/highlights.
Free would be best but conmmercial controls can also be used - but please no bloaded "complete editor" packages - my requirements are pretty simple and do not want a bloated control if I can avoid it
Any suggestions?
/B
|
|
|
|
|
Have you looked at the Editor from the SharpDevelop IDE here[^]?
Or Scintilla here[^]?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Check out ScintillaNet. It's a DotNet wrapper for the Scintilla control. Free control and you can easily customize the syntax highlighting via simple XML. The project is hosted at CodePlex.[^]
Supports line numbers, folding, etc. Built-in support for most popular languages.
|
|
|
|
|
Try ICSharpCode TextEditor (the one used by SharpDevelop). I use it and it is quite good.
|
|
|
|
|
Hi All,
I m developing one Windows Application in C# in VS2008. The following problem occurred in my application.
1. In my application when u open a Form the memory usage is increased to 100MB. This Form Contains more than 50000 Tree Nodes. These Nodes taking that amount of memory. Then After if i closing that opened Form how much amount of memory is raised when that form is opened that amount of memory is not released when that form is closed.
Please give me solution for this how to free the memory when that form is closed.
Thanks,
Kedar
|
|
|
|
|
k_kedarnadh wrote: that amount of memory is not released
who says?
objects that are no longer reachable become collectible, so when your app needs memory and runs its GC, it will collect them and reuse the memory. Most often it will not return the memory to Windows though, why should it? It would return what is redundant to Windows when your app gets minimized.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
If you're looking in TaskManager, you're looking in the wrong place to see how much memory your app is actually using.
|
|
|
|
|
DataTable dt;
private void Permissions_Load(object sender, EventArgs e){
dt = new DataTable();
dt.Columns.Add("Feature", typeof(string));
dt.Columns.Add("None", typeof(bool));
dt.Columns.Add("ReadOnly", typeof(bool));
dt.Columns.Add("ReadWrite", typeof(bool));
datagridview1.Datasource=dt;
}
private void btnSave_Click(object sender, EventArgs e){
in the grid when i'll click on the any checkbox i want to pass parameter to this function SetPermission( , , );
parameter will be from the two enumeratons below
How manage it?
here picture <a href="http://s55.radikal.ru/i150/0910/48/caabea077416.jpg">Picture</a>
}
public void SetPermission(Permission feature, PermissionType permission, int userID) {
SqlCommand cmd = new SqlCommand("Insert into Permissions (UserID,Feature,Permission)Values(@UserID,@Feature,@Permission)", con);
cmd.Parameters.Add(new SqlParameter("UserID", userID));
}
public enum Permission : int
{
Country = 0,
Store = 1,
City = 2
}
public enum PermissionType : byte
{
None = 0,
ReadOnly = 1,
ReadWrite = 2
}
C# Developer
modified on Monday, October 26, 2009 3:18 PM
|
|
|
|
|
From reading your question, which was slightly difficult because your actual question is mixed up in the middle of your code, I would suggest that you redesign your DataTable
private void Permissions_Load(object sender, EventArgs e){
dt = new DataTable();
dt.Columns.Add("Feature", typeof(string));
dt.Columns.Add("None", typeof(bool));
dt.Columns.Add("ReadOnly", typeof(bool));
dt.Columns.Add("ReadWrite", typeof(bool));
datagridview1.Datasource=dt;
}
The three columns marked //<======================== Here =============== are the three possible values of PermissionType and should be one column, probably, without thinking about it too much, of type int . This would mean that the design of your Form and Grid would need to change which would therefore probably change the question.
Also you refer in the question bit to the any checkbox without having previously mentioned it, let alone describe its purpose.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Henry Minute I'll try to explain it
Here is link of Picture http://img9.imageshack.us/i/35025568.jpg/
When I click on any checkbox here,I want to pass parameter in set function, for example like this: if I'll click on row Stores, Column read only's expedient checkbox item i want to pass SetPermission(1,1, ...) because in enumeration stores id is 1 and read only's id is 1 too.
C# Developer
|
|
|
|
|
I am not able to view your image, as I am having bandwidth problems and it would take about 20mins to load (I probably wouldn't anyway - no reflection on yourself but I am very distrustful of following links. )
My basic problem with the code you presented originally is that nowhere in it do you load any existing data. I can only assume therefore that the part you are working on is for new data only. On that basis if you must use a grid it would make things a whole lot easier to code for if, instead of 3 (or however many options there are) CheckBoxColumn s, you had 1 ComboBoxColumn with its items set to the possible options. What would happen if the number of options suddenly increased to 20+, are you going to add that number of additional CheckBoxColumn s?
In any event, as soon as the user makes a selection you are saving the data, so why use a grid? It would be far, far easier to simply have appropriate controls on a Form or Panel and clear them on a successful save ready for the next entry and leave them populated on any error so that corrections can be made.
Sorry not to be more help, but it really seems to me that your design needs some more thought.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Try the following. It may help you. Remember that you have to initialize check box values at first.
private void Form1_Load(object sender, EventArgs e)
{
int p = dataGridView1.Rows.Add();
dataGridView1.Rows[p].Cells[0].Value = true.ToString();
dataGridView1.Rows[p].Cells[1].Value = false.ToString();
}
Handle the following event of datagridview
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().Equals(false.ToString()))
{
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = true.ToString();
MessageBox.Show("true");
}
else
{
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = false.ToString();
MessageBox.Show("false");
}
}
call the method in appropriate if else condition.
|
|
|
|