|
hi ,
i have this problem,
i have a grid contains project combo box and projectStage combo,when i select the project from first combo it will filter the second combo values,
i got it but when i m selecting the project for the next row it filter all second combo values even in the first row, here is my code
private void FrmMain_Load(object sender, EventArgs e)
{
EMS.Timesheet timesheet = new WindowsApplication1.EMS.Timesheet();
dsInitialData = timesheet.GetInitialData(UserProfile.EmployeeId);
bscProject.DataSource = dsInitialData.Tables["Projects"];
dgvTimeAttProject.DataSource = bscProject;
dgvTimeAttProject.DisplayMember = "ProjectRef";
dgvTimeAttProject.ValueMember = "ProjectId";
bscStage.DataSource = dsInitialData.Tables["Stages"]; ;
//bscStage.Filter = "ProjectTypeId=-1";
dgvTimeAttStage.DataSource = bscStage;
dgvTimeAttStage.DisplayMember = "StageName";
dgvTimeAttStage.ValueMember = "ProjectStageId";
}
private void dgvTimeAtt_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
try
{
if (e.RowIndex == -1)
return;
if (dgvTimeAttProject.Index == e.ColumnIndex)
{
int ProjectId = (int)dgvTimeAtt.Rows[e.RowIndex].Cells[dgvTimeAttProject.Index].Value;
int projectTypeId = GetProjectType(ProjectId);
bscStage.Filter = "ProjectTypeId=" + projectTypeId.ToString();
bscActivity.Filter = "ProjectTypeId= " + projectTypeId.ToString();
//dgvTimeAttStage.DataSource = dsInitialData.Tables["Stages"].Select("ProjectTypeId=" + projectTypeId.ToString());
//dgvTimeAttActivity.DataSource = dsInitialData.Tables["Activities"].Select("ProjectTypeId= " + projectTypeId.ToString());
}
}
catch (Exception ex) { throw ex; }
}
so how can i overcome this problem?
|
|
|
|
|
i will ask it in other words,
if i have grid with tow DataGridViewComboBoxColumn first one for contries and second one for cities , when the user select a country the city combo will have the all cities in the country selected in first grid ,
i did it like that:
bscCountries.datasource=GetAllCountries();
dgvCol_Countries.DataSource =bscCountries;
dgvCol_Countries.DisplayMember ="Name";
dgvCol_Countries.ValueMember = "ID";
bscCities.datasource=GetAllCities);
dgvCol_Cities.DataSource =bscCities;
dgvCol_Cities.DisplayMember ="Name";
dgvCol_Cities.ValueMember = "ID";
private void dgvTimeAtt_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
bsc_Cities.filter="CountryId="+dgvCol_Countries.Rows[e.RowIndex].Cell[e.CellIndex].value;
}
that's work fine but , when i go to next row in the grid and select other country the selected city i choose is gone .
How can i fix it?
|
|
|
|
|
Hi friends,
I need to split the line which I am reading from a csv file using ,(comma). But I need to skip the commas which are coming inside quote.For example for line
1,12/12/2008,"This is test, test2"
The result should be
1<br />
12/12/2008<br />
"This is test, test2"
not like
1<br />
12/12/2008<br />
"This is test, <br />
test2"
Please guide me to do this with regular expression or by any other method.
Thanks in advance
Ramesh Ramalingam
|
|
|
|
|
Personally I'd iterate over each character in the string, adding it to a stringbuilder and outputting the result on a comma or end of line. Use a boolean toggle on double quotes to disable in quote commas.
Regards,
Rob Philpott.
|
|
|
|
|
|
I wrote a class for expressly that purpose.
http://www.codeproject.com/KB/recipes/qstringparser_net.aspx[^]
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
You've not given enough information about the format of your string, so this regex will match the given string, but might not work on other strings:
(\d+),(\d+/\d+/\d+),(.+)
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I wrote a class that supports quoted strings.
http://www.codeproject.com/KB/recipes/qstringparser_net.aspx[^]
It should do exactly what you want. To see it work, run the demo app.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I didn't read it closely; does it support escaped quotes within quoted strings?
|
|
|
|
|
No, but you could always extract the quoted string as a field, and then create another parser instance and let fly.
string data = "my mother,the car,"other stuff,'my,other,stuff'",lastfield;
StringParser parser = new StringParser(data, ",", "\"");
string quotedField = parser.GetField(2);
StringParser parser2 = new StringParser(quotedField, ",", "\'");
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
modified on Wednesday, December 31, 2008 3:06 PM
|
|
|
|
|
This should match a CSV line with one or more values, inluding quoted values containing commas and encoded quotes:
("(?:[^"]|"")*"|[^,\r\n])(?:,("(?:[^"]|"")*"|[^,\r\n]))*
(No guarantees, not tested.)
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
What about newlines within quotes?
|
|
|
|
|
PIEBALDconsult wrote: What about newlines within quotes?
That should be handled. [^"] matches any character except a quotation mark, so that includes newline characters aslo.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thank you friends, I got some ways to do the from your replies. Thank you very much for all support. I will get you with the solution after I resolved my problem fully.
|
|
|
|
|
Hi i am Datta,
i have html containg Window User control .
This Window user control have a textbox and setter property to set text of textbox.
i embedded this User Control inside html and want to communicate html textbox with that textbox of user control via Javascript.
but i am failed to set value of textbox of User control.
I am Using .NET 2.0 VS 2005 and C# lang.
If any body knows solution
thanks in advance..
DaTtA
|
|
|
|
|
Hi,
this is venkat
I have a issue with parsing a query in that i have to separate all the words and phrases separately for process farther.
|
|
|
|
|
I'd use a regex, take a look at this tutorial[^].
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
thanks for u r suggestion
|
|
|
|
|
Use Split if you need to get all the words in an array. If it is some specific word or phrase, use Regex as replied earlier.
C isn't that hard: void (*(*f[])())() defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void
"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." - Martin Golding
|
|
|
|
|
See if my parsing class will help:
http://www.codeproject.com/KB/recipes/qstringparser_net.aspx[^]
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
|
Hi all,
I m trying to read the contents from one word document and writing in a newly created word document. I wish to apply a color to the string while writing. I tried the html tags as follows
swFile.WriteLine("<body><Font color=#FF0000 Face=courier new>" + s + "</font><br>");
the above code is working, but the original alignments(i.e tab spacing and other allignments) is changed for every line.
for eg, original: ashok ashok ashok ashok age 22
output:ashok ashok ashok ashok age 22 (color:red)
when writing normally all the indendations are coming properly as of in the original document.
kindly help me out.
</body>
|
|
|
|
|
You can create a Range object and use its Font.Color (not sure if it is color of forecolor).
Do not double post.
C isn't that hard: void (*(*f[])())() defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void
"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." - Martin Golding
|
|
|
|
|
Hi, I'm using Windows XP Pro and VS 2008 Team Edition. The project I am working on is targeting .NET 3.5. I downloaded the MySQL .NET connector 5.2.5 and installed it. Installation was successful. I could even find the updated machine.config file. But whenever I try to reference any of the classes (ex: MySql.Data.MySqlClient ) I get this error:
"The type or namespace name 'MySql' could not be found (are you missing a using directive or an assembly reference?)"
Now I have tried everything I could. Copied the MySql.Data.dll to .NET installation locations for both 3.5 and 2.0. Installed the dll in the global assembly cache using gacutil, copied the dll in my project's folder, in short anything and everything that I found I could do using web search and as such, although I was not supposed to do anything, the installer downloaded from MySQL website should have done everything. But the problem remains.
Can anyone here please provide any solution? Thanks in advance.
|
|
|
|
|
adding the reference of that dll in ur project might solve ur problem
rahul
|
|
|
|