|
Instead of wasting time on typing so much. You could have tried it with some regex example. That would have taken less time.
Anyways it is possible
Nana
|
|
|
|
|
"Anyways it is possible"
How is that possible
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add(@"^L(\w{1})$", "0");
Why does dic.ContainsKey("LA") return false when it matches regex?
|
|
|
|
|
First thing I think the interpretation is wrong.
You are not using a Regex as a key of the dictionary.
Its a string object.
Then how can you search the contains key on regex?
Nana
|
|
|
|
|
You have to iterate over the dictionary I'm afraid. You are trying to shoehorn functionality into an item that is only a key, and has no purpose other than to identify a particular item in the collection for quick retrieval.
|
|
|
|
|
The biggest problem with that is that the value passed in may match more than one key's pattern even though the patterns are unique. You'll need to decide what to do in those cases. Iteration will be required.
|
|
|
|
|
hi guys
what is this operator " {0} "?
such as:
Console.WriteLine("Property Value: {0}", ///);
saeed ghanavat
|
|
|
|
|
saeed470 wrote: what is this operator " {0} "?
This can be replaced by the object specified.
string str = "test";
int a = 10;
Console.WriteLine("{0}{1}",str,a) If you are using this, you can avoid casting the object to string explicitly.
|
|
|
|
|
i have menu in my application and i need to create general form object that can be converted to type of the active form to execute some void in active form so i need to convert (frm) which is form to customized form like employeeform and so on
thanks
md_refay
|
|
|
|
|
What is the question?
Nana
|
|
|
|
|
Hi,
I was doing some experiments with C# 3.5 and I got the following code which is very tough to digest for me. Could anyone help me to understand this ?
class MySimpleClass
{
private string _Property1 = string.Empty;
private string _Property2 = string.Empty;
public string Property1
{
get { return _Property1; }
set { _Property1 = value; }
}
public string Property2
{
get { return _Property2; }
set { _Property2 = value; }
}
} Following is the code where above class instance are kept in a List<>
List<MySimpleClass> objList = new List<MySimpleClass>{
new MySimpleClass{Property1="Hello",Property2="Hello1"}
}; How such type of invoking is possible ? I checked with the overloaded constructors for List class. But I couldn't find any matching methods there. I tried removing the instance creating of MySimpleclass . Then it shows error no overload method matches the parameter. From this I guess when we specify in the above format, automatically it is calling the Add() method specified in the List . How this happening, since no overloaded constructor takes MySimpleclass as parameter ?
Any ideas ?
|
|
|
|
|
Maybe this blog will help. (at the object initializer part)
Click Here^
|
|
|
|
|
Thanks for the link. That explains the syntax well. But still I am not getting how the call is going to Add() method ? Let me try with creating a custom collection and adding items. Thanks again
|
|
|
|
|
Yes I found it. If any class which implements IList, and initialize like the above sample, it will call Add() method by default.
|
|
|
|
|
hi,
i am working on 2.0 winforms.
any plz tell me how to show an icon or image in ListView ColumnHeader.
thanks
Ramana
|
|
|
|
|
Check this[^] out.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
I have created a MDI form and is has menus like file edit etc. On file menu I have login sub menu. I initially disable all the menus except file. With click on login sub menu login form open and user can put user name and passowrd. The question is if that password is correct I need to enable the menus. How is it possible ? please help me.
keyto
|
|
|
|
|
This[^] article might help you. It does something very similar, so should serve as a good start.
|
|
|
|
|
hi
how can i zip and unzip file in C# code ?
thank's
|
|
|
|
|
depend onthe zipping/unzipping tool.
use System.Diagnostics.Process class,
through Process class execute the zipping executable with command line parameters.
convert zipped/unzipped files to the stream & write into the hard disk?
go it?
Ramana
|
|
|
|
|
Hello,
You could use "SharpZibLib", which is a part of the free "SharpDevelop" project!
Can be downloaded (with examples) here![^]
All the best,
Martin
|
|
|
|
|
Hi.....
By using GZipStream class you can compress and decompress the file.....
GZipStream Example Link[^]
Regards,
Sandeep Kumar.V
|
|
|
|
|
hi,
I have fetched two database tables "MTQABenchMarks" and "Users" in the datagridview. This is a windows application. Now I have to update the "MTQABenchMark" database after making changes to the datatable present in the application. When I run the code it is throwing an exception "Dynamic SQL generation is not supported against multiple base tables." How to solve this. the code is
public Form1()
{
InitializeComponent();
}
static SqlConnection Con = new SqlConnection("Data Source= 192.168.100.234; Initial Catalog=gishyd; User ID=sa; password=gis*2005");
SqlDataAdapter Da = new SqlDataAdapter("SELECT dbo.Users.UserID, dbo.MTQABenchMark.Id as EmpID, dbo.Users.FirstName + ' ' + dbo.Users.LastName AS Name, dbo.MTQABenchMark.NoofMinPerDay,dbo.MTQABenchMark.PerMonth FROM dbo.Users INNER JOIN dbo.MTQABenchMark ON dbo.Users.UserID = dbo.MTQABenchMark.EID ", Con);
DataSet Ds = new DataSet();
private void Form1_Load(object sender, EventArgs e)
{
Da.Fill(Ds, "MTQABenchMark");
dataGridView1.DataSource = Ds.Tables["MTQABenchMark"];
}
private void button2_Click(object sender, EventArgs e)
{
SqlCommandBuilder CmdBld = new SqlCommandBuilder(Da);
Da.InsertCommand = CmdBld.GetInsertCommand();
Da.Update(Ds, "MTQABenchMark");
MessageBox.Show(" Database is Updated");
}
}
}
Please Help.
Nitin Raj Bidkikar
Nitin Raj Bidkikar
|
|
|
|
|
You have 2 options.
1. Don't use INNER JOIN in your query. Get both tables separately and make relation between them at .NET level. Here you can select like a INNER JOIN only related records in both tables.
2. Don't generate and get INSERT or UPDATE command from Command Builder. Build manually INSERT or UPDATE commands for the ADAPTER.
For more information on these approaches GOOGLE.
Regards
|
|
|
|
|
Hi
I am trying to write a windows services(first time).
I want it to write the name of each file opened in a notepad document.
I have written some code for it and I do have a service now which makes entry in the event log whenever it is started or stopped.
From where can I get a code understand what should be done next?
I dont want exact code; just a help to understand services
Chaos, panic and disorder - my work here is done.
|
|
|
|
|