|
Have a look at http://www.codeproject.com/cs/library/typebuilderlib.asp You might find it interesting
|
|
|
|
|
hi,
i am developing a windows application in that i want to extract all the email ids present in the body of a particular text file
any idea
jaz
|
|
|
|
|
1- Crate a regular expression for email.
2- Read each sentence of the text one by one.
3 -Match it with the regular expression, if matched successfully store it somewhere [Like array list].
4- When you will complete reading the text file, you will be having all the email ids with you.
Regards,
Prakash Kalakoti
|
|
|
|
|
Hi Prakash,
Thanks for your help
Now it is working properly
Thanks once again
jaz
|
|
|
|
|
Hi,
How to display icons/images on ListView SubItems using C#.Net 2?
Thanking you in advance
jaz
|
|
|
|
|
Try an ImageList .
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
no..i was asking about how to display icons on the subitems of a listview?
using imagelist, i know to display icons for listview items...but pls help how to display icons on subitems?
thanks
|
|
|
|
|
|
|
For the Best result. You can use the Telerik Component. Which will be So good to solve ur problem
Regards,
A Jabeer Ali
|
|
|
|
|
I am just a beginner in C# and need to create a basic C# form to enter student information:
first and last name
email
graduation year
month of graduation
I have to use some type of menu for the graduation year and month (dropdown, radio button list or checkbox list).
I have used C# code generator to create the following code:
using System;
namespace SIU.Student.Graduation
{
public class EntryForm
{
// private members
string strFirstName;
string strLastName;
string strEMail;
string strGraduationYear;
string strGraduationMonth;
// empty constructor
public EntryForm ()
{
}
// full constructor
public EntryForm (string FirstName, string LastName, string EMail, string GraduationYear, string GraduationMonth)
{
this.strFirstName = FirstName;
this.strLastName = LastName;
this.strEMail = EMail;
this.strGraduationYear = GraduationYear;
this.strGraduationMonth = GraduationMonth;
}
// public accessors
public string FirstName
{
get { return strFirstName;}
set { strFirstName = value; }
}
public string LastName
{
get { return strLastName;}
set { strLastName = value; }
}
public string EMail
{
get { return strEMail;}
set { strEMail = value; }
}
public string GraduationYear
{
get { return strGraduationYear;}
set { strGraduationYear = value; }
}
public string GraduationMonth
{
get { return strGraduationMonth;}
set { strGraduationMonth = value; }
}
}
}
using System;
using System.Data;
using System.Data.Client;
namespace SIU.Student.Graduation.Data
{
public class SqlDataProvider
{
public SqlDataProvider(){}
public void AddEntryForm(EntryForm EntryForm)
{
// Initialize SPROC
SqlConnection conn = new SqlConnection(Globals.ConnectionString);
SqlCommand cmd = new SqlCommand("KSU.Student.Graduation_EntryForm_Add", conn);
cmd.CommandType = CommandType.StoredProcedure;
// Add Parameters
cmd.Parameters.Add("@firstName", EntryForm.FirstName);
cmd.Parameters.Add("@lastName", EntryForm.LastName);
cmd.Parameters.Add("@eMail", EntryForm.EMail);
cmd.Parameters.Add("@graduationYear", EntryForm.GraduationYear);
cmd.Parameters.Add("@graduationMonth", EntryForm.GraduationMonth);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}
public void UpdateEntryForm(EntryForm EntryForm)
{
// Initialize SPROC
SqlConnection conn = new SqlConnection(Globals.ConnectionString);
SqlCommand cmd = new SqlCommand("KSU.Student.Graduation_EntryForm_Update", conn);
cmd.CommandType = CommandType.StoredProcedure;
// Update Parameters
cmd.Parameters.Add("@firstName", EntryForm.FirstName);
cmd.Parameters.Add("@lastName", EntryForm.LastName);
cmd.Parameters.Add("@eMail", EntryForm.EMail);
cmd.Parameters.Add("@graduationYear", EntryForm.GraduationYear);
cmd.Parameters.Add("@graduationMonth", EntryForm.GraduationMonth);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}
public void DeleteEntryForm(EntryForm EntryFormID)
{
// Initialize SPROC
SqlConnection conn = new SqlConnection(Globals.ConnectionString);
SqlCommand cmd = new SqlCommand("KSU.Student.Graduation_EntryForm_Delete", conn);
cmd.CommandType = CommandType.StoredProcedure;
// Delete Parameters
cmd.Parameters.Add("@EntryFormID", EntryFormID);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}
public EntryForm GetEntryFormByID(EntryForm EntryFormID)
{
// Initialize SPROC
SqlConnection conn = new SqlConnection(Globals.ConnectionString);
SqlCommand cmd = new SqlCommand("KSU.Student.Graduation_EntryForm_GetByID", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataReader reader = null;
EntryForm entryForm = null;
// GetByID Parameters
cmd.Parameters.Add("@EntryFormID", EntryFormID);
// Execute
conn.Open();
reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
if(reader.Read())
{
entryForm = SqlDataHelpers.PopulateEntryFormFromSqlDataReader(reader);
}
conn.Close();
return entryForm;
}
public static EntryForm PopulateEntryFormFromSqlDataReader(SqlDataReader dr)
{
EntryForm entryForm = new EntryForm();
entryForm.FirstName = Convert.ToString(dr["firstName"]);
entryForm.LastName = Convert.ToString(dr["lastName"]);
entryForm.EMail = Convert.ToString(dr["eMail"]);
entryForm.GraduationYear = Convert.ToString(dr["graduationYear"]);
entryForm.GraduationMonth = Convert.ToString(dr["graduationMonth"]);
return entryForm;
}
}
}
I need to figure out way to code the drop-down menu for GraduationYear and GraduationMonth fields.
Can somebody provide a ready code snippet to insert it in the above code pls?
Do I miss any other important coding for this entry form?
Thanks so much!
heroz100
|
|
|
|
|
Hi,
Im trying to do a simple XML Record Lookup using the following code:
string fileName = "Account_Data.xml";<br />
XPathDocument doc = new XPathDocument(fileName);<br />
XPathNavigator nav = doc.CreateNavigator();<br />
<br />
XPathExpression expr;<br />
expr = nav.Compile("/Accounts/Account[FirstName='" + nameTextBox.Text + "']");<br />
XPathNodeIterator iterator = nav.Select(expr);<br />
iterator = nav.Select(expr);<br />
<br />
if (iterator.MoveNext())<br />
{<br />
<br />
<br />
}<br />
else<br />
{<br />
<br />
<br />
}
It works just fine, but there seem to be a minor bug with it. In the XML file, i already have a record with <firstname>Latheesan, so when i searched using my search form for "latheesan", it returned 0 results, hense it created a new record.
How can i avoid case sensitiveness issues with searching through XML Records?
|
|
|
|
|
Never done this myself, but I think you can only avoid case sensitiveness by turning both the search string as well as the content of FirstName to either upper or lower case. For the search string you can use the appropriate methods provided by the String class. In case of the content of FirstName you'll have to use XPath functions[^].
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi, can anyone please enlighten me on how to create dynamic objects with different names during run time?
Thanks =)
|
|
|
|
|
Unclear question but that might be the answer
Object obj = System.Activator.CreateInstance()
|
|
|
|
|
Hi
I'm showing a few tables (user selects which one he wants to edit using ComboBox).
The data is passed to DataGridView (variable dgvEditTable):
string strSQL = "select * from " + cbEditTable.SelectedItem.ToString();<br />
<br />
mySqlDataAdapter = new MySqlDataAdapter(strSQL, MySQLConnection.ConnectionString + ";allow zero datetime=yes");<br />
MySqlCommandBuilder commandBuilder = new MySqlCommandBuilder(mySqlDataAdapter);<br />
<br />
mySqlTableEdit = new DataTable();<br />
mySqlTableEdit.Locale = System.Globalization.CultureInfo.InvariantCulture;<br />
mySqlDataAdapter.Fill(mySqlTableEdit);<br />
<br />
BindingSource dbBindSource = new BindingSource();<br />
dbBindSource.DataSource = mySqlTableEdit;<br />
dgvEditTable.DataSource = dbBindSource;
I'm using MySql Connector .NET 1.0.9 as a provider.
Everything works great until the user don't touch a Date or DateTime field. When user puts some valid date [eg: 2006-05-20] and tries to leave edited cell DataGridView rises an exception:
The following exception occurred in the DataGridView:
System.FormatException: Invalid cast from 'System.String' to 'MySql.Data.Types.MySqlDateTime'. ---> System.InvalidCastException: Invalid cast from 'System.String' to 'MySql.Data.Types.MySqlDateTime'.
[... the rest of the stack of used methods ...]
I've found description of this exception here, but the only solution there is to change a type of field to String. Well, I've tried this but I got another exception "Cannot change DataType of a column once it has data.".
Any suggestions are welcome.
This is the one of the last parts of my final project for studies and I must finish it before end of May. I'm toasted
-- modified at 17:37 Thursday 17th May, 2007
-- modified at 17:39 Thursday 17th May, 2007
"In the brave new world of the year 2000, a kiss can still break your heart." - Program from Cirque du Soleil's Alegría
|
|
|
|
|
Hello,
I have this search method which is called when the user enter some value into textbox and presses Search button.
If a record is found, it's supposed to open a form called Account Management Form. What i wanted to achieve was, Close the search form right after the record is found and Acc Management Form is being opened.
this is the code i have so far:
private void doEditAccount(IAccount account)<br />
{<br />
this.close();<br />
AccountManageForm form = new AccountManageForm(account);<br />
form.ShowDialog();<br />
}<br />
<br />
private void searchBtn1_Click(object sender, EventArgs e)<br />
{<br />
string fileName = "Account_Data.xml";<br />
XPathDocument doc = new XPathDocument(fileName);<br />
XPathNavigator nav = doc.CreateNavigator();<br />
<br />
XPathExpression expr;<br />
expr = nav.Compile("//Account[@ID='" + accountIDInput.Text + "']");<br />
XPathNodeIterator iterator = nav.Select(expr);<br />
iterator = nav.Select(expr);<br />
<br />
if (iterator.MoveNext())<br />
{<br />
XPathNavigator nav2 = iterator.Current.Clone();<br />
string tmpAccID = (nav2.GetAttribute("ID", ""));<br />
nav2.MoveToFirstChild();<br />
string tmpName = (nav2.Value);<br />
<br />
IAccount account = new Account(tmpName, "");<br />
doEditAccount(account);<br />
}<br />
}
In theory, shouldn't the search form get closed because of the line this.close(); inside the doEditAccount method and then open the Acc Management Form...
but in my testing, the Adv Search Form won't close. Im i doing something wrong? or is there another way to force a form window to close before opening another one?
|
|
|
|
|
Latheesan wrote: this.close();
what is "this" ?
|
|
|
|
|
Correct me if im wrong, but isnt "this." used to select the current opened/active form?
Even if i don't use this.Close(); i tried the following options to form the form to close:
Close();
AdvSearchForm.ActiveForm.Close();
Still no luck, this is what i could think of top of my head and from my past exprience with form closing...
|
|
|
|
|
You obviously don't know C#, do you? The This keyword refers to the current instance of the class, kind of like the Me keyword in VB.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
You obviously don't know C#, do you?
Yea you are correct, im still learning
|
|
|
|
|
May I suggest you buy a book on the C# language; and read, study and understand it
completely, so you know the language and some OO concepts, before you engage in creating fancy programs.
That too is "separation of concerns", one of the modern software concepts.
|
|
|
|
|
Latheesan wrote: Yea you are correct, im still learning
I was talking to Luc Pattyn . But if you need a good book on C#, I would suggest: Learning C# 2005.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
MatrixCoder wrote: You obviously don't know C#, do you?
I'm guessing that Luc knows C# and was just requesting more info on the context of the code.
|
|
|
|
|
Did you try Application.Exit(); ?
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|