Question: I have a form and two custom `UserControl` that I made myself. one control has some buttons that each of these button have theire `Tag` property set to an array of `PointF`. I have another UserControl that has a `ObservableCollection<PointF[]>` that I set its event handler to draw the lines if data is being added to it. This works fine If I put the data points on its own class...just make to sure it works.

No my problem is, having this two control in one form, how can I set the click event of buttons in the first control, to add data points to the second control?

This two controls are both in two different projects in my soloution. and the form that these to controls are being showed in, is also in a different project (it is the launching project of soloution)

Answer: 
If you want to achieve replacing portion of the filename with something else, you should use a `sub` or `gsub` function of the `String` class:

`filename = File.basename(f, File.extname(f))`

Now in filename you have stored a `String` representing a current file's name. You can check it using `instance_of?` function of an `Object` class, just if you're curious:

```
filename.instance_of?(String)
# -> true

```

What you should do is to use `gsub` method to replace all occurencies of given string, or `sub` to replace only first of it. [Here](http://ruby-doc.org/core-1.9.3/String.html) you can find detailed information of using these functions.

I suppose in your case this should do the trick:

```
filename.gsub('my name', 'my (first) name')
# 2nd question:
filename.gsub("my first name", "myfirstname")

```

Also, regular expressions are allowed in `sub` and `gsub` methods. You should give it a try if you want to write more complex patterns, for example strip all numbers from file.
A nice way to create strings with variables in Ruby is:

```
first = "Eugene"
filename = "This is my #{first} name"

```

filename is equal to "This is my Eugene name"

so with the file portions you asked about:

```
"This is my #{folder_path}#{filename.gsub!(' ', '').capitalize}#{File.extname(f)}"

```

Removing spaces can be done with gsub 
(check out string class documentation <http://www.ruby-doc.org/core-1.9.3/String.html>):

```
filename.gsub(' ', '')

```

You can also use the File classes join method to concatenate strings into a path and avoid cross platform issues with slashes ('/' vs '\')
For more see <http://www.ruby-doc.org/core-1.9.3/File.html#method-c-join>