I thought I had tried the lazy flag, but it seems to have fixed my issue. Thanks!
Andrew Stampor
Posts
-
Probably an easy Regex question -
Probably an easy Regex questionThis is probably something easy for someone who is experienced with Regex and regular expressions in general. Unfortunately, I am not one of those people. Perhaps one of you kind souls will take pity on me and help me out here. I need to replace a part of a string with another string. I only want to replace the first instance. An example of the the beginning of the string being searched is as follows:
<chart first_node_id="None" item_id="323f359f-f2db-4cd5-b779-aebc1349d587" form_type="None" name="here is an old name" last_modified="1/16/2008 11:03:33 AM"> <node name="don't change this name" node_id="ff918de6-213d-4a11-8c1c-ce5b54c7d8f2" result="None"
What I want to find and replace is the "here is an old name" part. Note that 'name=' is repeated, and I only want the first one replaced. I've tried several different expressions, but the one I am currently toying with is as follows:Regex regExp = new Regex("name=\"(.*)\""); string test = regExp.Replace(oldString,newName,1);
This doesn't do what I want. It finds 'name="here is an old name" last_modified="1/16/2008 11:03:33 AM"' and replaces the whole thing instead of just what is between the quotation marks. I've been trying to read up on reg expressions and Regex, but the time crunch I am under is making me impatient and it is hard to learn with that mentality. So, any help you can provide would be most appreciated. Thanks in advance. -
How can I write text to a picturebox?The picturebox is inherited from and extended. I do not know which form(s) it will necessarily be on. I was able to take care of it with OnPaint. Thanks for your help, guys.
-
How can I write text to a picturebox?I only have access to the picturebox itself. Using a label would be a good way, but I cannot rely on it. I think I will try to override the OnPaint, but it seems like more trouble than it should be.
-
How can I write text to a picturebox?For the project I am working on, if I cannot find an image, I am going to write the image name to the picturebox instead. However, there doesn't seem to be a straightforward property (like "Text") that I can use. Is there an easy way to do this?
-
Fixing flicker in a DataGridView?Instead of creating my own implementation of the IBindingList interface, I used the BindingList class. When I was updating the properties of the objects in the list, it was not triggering the ListChanged event. When I looked at ListChanged in help, it mentioned that it will only be fired by items in the list that implement the INotifyPropertyChanged interface. I added INotifyPropertyChanged to my object class and had it trigger the PropertyChanged event when one of the properties I was interested in changed. This resolved both the issue with the grid not updating and the flickering issue I was having before. Thanks for all of your help. :-D You never mentioned the INotifyPropertyChanged interface, so if you haven't heard about it until now, I'd suggest giving it a look.
-
Fixing flicker in a DataGridView?OK... I've changed the List to a BindingList, but when I make changes to the Properties, it doesn't update on the DataGridView. Is there a way I can trigger that event?
-
Fixing flicker in a DataGridView?Hmmm... would this refresh only the changed cells in the grid, or does it refresh the whole thing anyway?
-
Fixing flicker in a DataGridView?Thanks for your reply. I've changed the way I am trying to do this, but am not getting an update like I would like. What I am now doing is maintaining a List<CSomeObject>. That List is assigned as the datasource for the DataGridView. What I am noticing, though, is that when I update a value in one of the CSomeObjects that is part of the List, the value doesn't change on the grid until I click on the grid. Do you know what I am missing?
-
Class objects as Datasources [modified]I have a "List<CSomeObject> someList" with several properties. When I assign my "dataGridView.DataSource = someList" it populates the DataGridView, but the order of the properties is seemingly random. Can I specify the order somehow? Also, can I change the name of the columns instead of being forced to use the Property name? -- modified at 15:45 Monday 12th June, 2006
-
Fixing flicker in a DataGridView?I am using a DataGridView to display a List of objects that change frequently (at a rate of up to 4 times per second.) I am using a BindingSource as the DataSource for the DataGridView and on every datachange event I set the BindingSource's DataSource to the List of objects. This results in a bunch of flicker. I attempted to fix this using SuspendLayout and ResumeLayout, but haven't seen a difference. Any ideas?
-
Simple Database accessThanks for your help! I've been looking through the example at the site you suggested and I am having a little trouble getting it to run. I've installed "Microsoft SQL Sever 2005" and am trying to run the code from lesson 2 (http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson02.aspx). When it gets to the "conn.Open()" call, I get an exception, which says: "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)" I have attempted to resolve this but am not sure what needs to be done. I cannot find a setting that specifically allows or disallows remote connections.
-
Simple Database accessI would like to write a simple inventory application in C# to keep track of my dvds, music and books. While I'll use this application, I am more interested in it for the opportunity to familiarize myself with accessing a database in C#. However, my knowledge about databases, particularly accessing them in C#, is limited. I am looking for suggestions on a good way to set up this application and databases. Tutorials, code snippets or full blown applications that access a database in a way similar to what I would be doing are all helpful. Thanks for any help / suggestions you can give.
-
Looking for a base class with typeof?Ah! This is what I want. Thanks.
-
Looking for a base class with typeof?Ah, thanks! That is what I wanted. In case anyone else is interested, another way to handle this issue (or get around it) is by associating your base class with an interface. All inherited classes are also of the same interface so I was able to do something like this:
if (sender is ISomeInterface)
{
// Do Something
} -
Looking for a base class with typeof?I have a case where several objects may trigger an event that is handled in one place. I use the sender object type to determine whether I should perform some task on the object. However, how can I catch the condition where an object inherits from the type of object I am interested in? I'd like to include that object as well. Here is an example of what I am doing:
if (sender.GetType() == typeof(CMyClass) ) { //Do Something }
If something is derived from CMyClass, I'd like it to go through the "Do Something" code. How can I check for it? -
Direct memory access of other applications?Thank you very much. This does look just like what I want. :-D
-
Direct memory access of other applications?I am writing a utility that will interact with another piece of software (Civ III). What I am trying to do is to access the turn number from my application. However, I am having difficulty finding information on how to do this. Can anyone direct me to a good example of this, or have any suggestions? Thanks. edit: let me clarify, I need general information on accessing memory from another application, not on the specifics of Civ III. :)
-
Scrollbar maximum value problemOK, I found the problem... but wtf? Maximum doesn't mean maximum? Since when does Maximum mean "maximum - largechange + 1"? How is that beneficial? Any insight as to why that design choice was made?
-
Scrollbar maximum value problemI've added a horizontal scrollbar to my form and want to have it change a value in a textbox. Well, everything works fine... except that the scrollbar can only reach 91 (with the maximum set to 100). Now, with the textbox I can set the scrollbar to its max, but I cannot scroll to it. Any known issues, tricks or properties I need to know about? Thanks.