I have build a litte asp.net form that searches for something and displays the results. I want to highlight the search string within the search results. Example:
Query: "p"
Results: a<b>p</b>ple, banana, <b>p</b>lum
The code that I have goes like this:
public static string HighlightSubstring(string text, string substring)
{
var inde...
What is the problem with this code?
for (int w = 0; w < this.Controls.Count; w++)
{
if (this.Controls[w] is TransparentLabel)
{
la = (TransparentLabel)this.Controls[w];
if (la.Name != "label1")
{
la.Visible = false;
la.Click -= new System.EventHandler(Clicked);
this.Con...
This question is similar to http://stackoverflow.com/questions/2835192/linq-group-one-type-of-item but handled in a more generic way.
I have a List that has various derived classes. I may have something like this:
List<BaseClass> list = new List<BaseClass>() {
new Class1(1),
new Class2(1),
new Class1(2),
new Class3(1),
new Cl...
Hi All
I have a TextBox that I allow my users to rotate. But what I would LOVE for my users is to have their Cursor rotate to the same angle that the TextBox was rotated at. For example, if they rotated the TextBox to 28°, then when the Cursor enters that TextBox the Cursor should also rotate itself to 28°.
Any help at all will be grea...
I have the following XML that is provided to me and I cannot change it:
<Parent>
<Settings Version="1234" xmlns="urn:schemas-stuff-com"/>
</Parent>
I am trying to retrieve the "Version" attribute value using XPath. It appears since the xmlns is defined without an alias it automatically assigns that xmlns to the Settings node. When...
Situation:
In A form I have a TableLayoutPanel(Dock= Fill) and a label (which parent is the Form, not the tablelayoutPanel) which anchors are set to Top+Bottom+Left+Right.
Now, when I run this form and rezise it, the label does not center itself in the Form, as I expected.
Workarounds?
...
Hi, for a PerCall WCF service whose throttling has been set to be high (say, 200 max concurrent calls) would WCF bring up a new instance and invoke the request on a threadpool thread?
If it does, then does this have an impact on the total number of concurrent calls allowed?
I ask because I don't seem to ever hit the max number of concu...
Hi,
In the Java world, I often see separation between web server and application server. The idea is to scale out your "relatively" cheap web server easily and beef up your application server when needed.
However, I don't see this setup in the .NET/windows 2008 world all the much, why is that? One argument against this architecture i...
I am trying to build in SSH port forwarding into a .net application that I am writing.
I have tried using sharpSSH, but it requires the user to input their password every time, and I don't want that. I am going to handle storing the password.
I have downloaded Granados, but there is basically zero documentation for it. While I sift th...
Been trying to figure out, how do I capture the events from a listbox. In the template, I've added the parameter IsChecked="" which starts my method. However, the problem is trying to capture what has been checked in the method. SelectedItem only returns what is currently selected, not the checkbox.
object selected = thelistbox.Selec...
If I have an interface:
public interface IRepository<T>
And an abstract class:
public abstract class LinqToSqlRepository<T, TContext> : IRepository<T>
where T : class
where TContext : DataContext
And a whole bunch of implementations of IRepository / LinqToSqlRepository (e.g. AccountRepository, ContactRepository, etc...
I want to programatically configure the proxy settings for the wifi network on my Windows Mobile phone. Does anybody know how to do that using the .net compact framework?
...
It is possible to create a Func object what references a generic method? like the LINQ OrderBy:
public static IOrderedEnumerable<TSource> OrderBy<TSource, TKey>(
this IEnumerable<TSource> source,
Func<TSource, TKey> keySelector
)
...
Somewhere in C++ era i have crafted a library, which enabled string representation of the computation history.
Having a math expression like:
TScalar Compute(TScalar a, TScalar b, TScalar c)
{
return ( a + b ) * c;
}
I could render it's string representation:
r = Compute(VerbalScalar("a", 1), VerbalScalar("b", 2), VerbalScalar("c", ...
In C:\Program Files\Reference Assemblies\Microsoft\Framework i see v3.0 and v3.5. I found that path in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\InstallRoot which also has that path.
In C:\Windows\Microsoft.NET\Framework i see versions from 1 to 3.5
My app was built in msvs2010rc1 targeting 3.5. In fact in my project files i ...
I had someone advise me to avoid repeatedly calling String.Length, because it was recalculated each time I called it. I had assumed that String.Length ran in O(1) time. Is String.Length more complex than that?
...
It is possible to use appfabric for non web/asp.net caching ?
say instead of ncache/memcached etc.
...
I need to change the editor for a property attached to a .net PropertyGrid, but I cannot set the Editor attribute of that property, because the property was generated by a tool, including all attributes.
The desired editor is
System.Windows.Forms.Design.FileNameEditor
I can find many tutorials on the web to assign this editor to stri...
Setup -- Create a simple COM addin through DOTNET/C# that does nothing but sleep on the current thread for 5 seconds.
namespace ComTest
{
[ComVisible(true)]
[ProgId("ComTester.Tester")]
[Guid("D4D0BF9C-C169-4e5f-B28B-AFA194B29340")]
[ClassInterface(ClassInterfaceType.AutoDual)]
public class Tester
{
[STA...
I am setting my Winforms Button control properties to appear as a hyperlink would on a web page. I've formatted everything fine, except the border in the FlatAppearance object. I have code to act as pseudo-CSS (FormBackColor is a string constant.):
b.FlatStyle = FlatStyle.Flat
b.BackColor = ColorTranslator.FromHtml(FormBackColor)
b.For...