News: Sensation!!! Xanax death Discount drug phentermine Pink oval pill 17 xanax identification Cialis compare levivia viagra Vicodin health On line prescription viagra Cheap 37 5 phentermine Lipitor Buy tramadol cheap Dutasteride Keppra Does phentermine speed up metabolism Cheap phentermine canada Exelon Phentermine for less Sulindac Generic cialis softtabs Viagra erection Hydrocodone vicodin Cialis drug prescription Mephobarbital Enoxacin Trovafloxacin Cialis Bexarotene Generic india viagra 5 phentermine Hydroxyzine Clotrimazole Get viagra drug online Alternatives to viagra Ibuprofen Ambien overnight Written prescription for viagra Hydrocodone bitartrate acetaminophen Valium and xanax Advair How fast will phentermine work Procainamide Xanax high 180 phentermine Generic meridia Capoten Phentermine 90 day Phentermine drug interaction Phensuximide Difference between cialis and viagra Restoril Information on the drug xanax Levivia viagra online Flagyl Phentermine delivered cod Buy viagra in uk Adenosine Meridia side effects Daunorubicin Alternatives to phentermine Avapro Atenolol viagra Yohimbe and viagra Phentermine blue Gitalin Differin Colistimethate Xanax online without prescription Oleandomycin Fioricet medication Glycopyrrolate Yasmin Ecotrin I need to find cheap phentermine delivered to fl Levaquin Ceftriaxone Meridia Androgel Methylphenidate Levlen Letrozole Isotretinoin Cialis forums Generic ambien Permethrin Beconase Kanamycin Elocon Prozac soma Xanax overnight Phentermine free delivery Diazoxide Xanax weight loss Hexachlorophene Phentermine affordable Carbachol Acquisto cialis Naloxone Norethindrone Argento soma Leflunomide Risperdal Norepinephrine Perindopril Phentermine prescription online Where to buy viagra online Drug viagra Grapefruit xanax Buy tramadol online Azithromycin Flurazepam Viagra cost Ditropan Tramadol drug interactions Coumarin Phentermine yellow Adipex loss phentermine weight Hydrocodone apap 5 500 Buy meridia online Prescription phentermine with cod payment Prescription soma Phentermine hoodia Xanax gg 258 Use of viagra Chlorprothixene What does phentermine do to your heart Bretylium Celiprolol Phentermine online consultation Cephradine Locoid Order viagra canada Mexican phentermine Phentermine ups shipped Bush inauguration speech draft viagra bastard of Levivia compared to viagra Phentermine prices Saturday delivery phentermine Methoxamine Phentermine us pharmacy online consultation Free shipping with phentermine order Tessalon Cheap soma online Discount hydrocodone Viagra compared to levivia Octreotide Xanax demerol morphine no prescription needed Bontril phentermine adipex Phentermine sale site top Alesse Killer pain tramadol Tramadol cheap Phentermine canada Vicodin cod Cialis free sample Phentermine prescriptions online physiphen online Xanax drug test High cortisol level phentermine Estraderm Fioricet addiction Nexium Adipex diet phentermine pill Phentermine buy order Ofloxacin Lansoprazole Tetrabenazine Phentermine result Phentermine info Phentermine by cod Snorting xanax Motrin Herbal alternatives to viagra Side effects of viagra Vicodin picture Chlorpropamide Phentermine no credit card required Alternative new viagra Zoloft and xanax Cheapest secure delivery cialis uk Viagra drug Vancomycin Viagra Phentermine gynecomastia James thompson viagra lawsuit Phentermine 90 Xanax and drug testing Levodopa Discount phentermine to florida Vicodin Natural over counter just like viagra stores 5 pdr Chlorambucil Lipitor Acebutolol Viagra maker Dexfenfluramine Calcitriol Cheap phentermine with online consultation Viagra alternative Altace Cheapest phentermine pill Discount online phentermine Xanax pictures Payment Sell viagra Phentermine work Buy cialis online Does phentermine really work Cheapest viagra uk Get phentermine Crestor Xanax 2mg generic alprazolam 180 pills Xanax urine test Sophia viagra Adipex phentermine xenical Ambien Phentermine medical insert Lowest price on phentermine Phentermine medication Felodipine Protirelin Adipex Viagra online shop Cephapirin Leo phentermine order online Ambien addiction Asparaginase Diprolene Carvedilol Lamisil Phentermine depression Encare 0 buy by popl powered viagra wordpress Cialis overnight shipping Does viagra work for women Mifepristone Robaxin Tramadol Viagra and levivia Lansoprazole Tramadol hcl 50 mg tab Loss phentermine story weight No online prescription xanax Zoloft Phentermine side affects Clonazepam Buying viagra Midodrine Atracurium Phentermine addiction help Lidocaine Idarubicin Elavil Trimeprazine Nitroglycerin Phentermine low prices What does generic xanax look like Opipramol Nicorette Flagyl Viagra pill Macrobid Buy com lvivhost online viagra Multivitamins Bleomycin Budesonide Vicodin dosage Does viagra work Adalat Phentermine usa Losec Female viagra alternative Xanax and pregnancy Flavoxate Online tramadol prescriptions Multivitamins Buy phentermine without a prescription Difference between valium and xanax Phentermine on sale Nizoral Fatal dose of xanax Perscription cialis Phentermine and diet pill Diet discount phentermine pill Pictures of xanax bars Neomycin Amphetamine Xanax indications Buspirone Phentermine sites that ship cash on delivery Ergotamine Phentermine hydrochloride Compare viagra cialis levitra Tramadol and dosage Thyroid Female spray viagra Diet ingredient phentermine pill Buy phentermine online with pay pal Cleocin Spectinomycin Phentermine for weight loss Viagra users Trimethobenzamide Hetacillin Cefprozil Anafranil How long xanax stays in system Herbal viagra alternative Pilljar phentermine Atrovent Generic overnight viagra Capoten Amantadine Ecstasy Cheap tramadol cod Cefixime Pyridostigmine Fluorouracil Impotence picture pill viagra Cipro Lotrimin Soma side effects Somatostatin Xanax vs klonopin Vicodin m360 Gemfibrozil No prior perscription tramadol Dichlorphenamide Phentermine adipex diet pill prescription Phentermine works Carbenicillin Cialis drug interactions Xanax manufacturer Levlen Phentermine lowest price Humulin Soft cialis Phentermine in stock ready to ship saturday delivery Cialis vs viagra Meperidine Simvastatin Discount phentermine price Cardizem Lethal dose xanax Urine drug testing of tramadol Xanax cod Viagra for woman About xanax Isoetharine Donepezil Is xanax addictive Iodothyrin Cefoxitin Protonix Viagra pills Cause rebound weight gain phentermine Leflunomide Buy phentermine online cheap Generic prescription viagra without Ash of soma Order xanax cod Phentermine canadian pharmacy Provigil Price viagra viacreme Cialis dose Indomethacin Nadolol Generic cialis price Otc viagra Online consultation xanax Ionamin phentermine Beclomethasone Dichloralphenazone Theophylline Bumetanide Phentermine sales Keflex Xanax dosages Phentermine without a perscription Tramadol without a prescription No prescription phentermine Acetaminophen Clemastine Best price phentermine Uk viagra supplier Online pharmacies with doctor consultation for viagra Viagrafix Buy viagra on line Pyridoxine Lasix Protamine Phentermine hydrochloride ship to missouri Zuclopenthixol Prazosin Generic viagra lowest prices Shipping overnight phentermine Xanax long term use Xanax abuse Lynestrenol Xanax without prescription Does phentermine work Phentermine 30 mg Compare viagra to cialis Oxycontin Amerge Phentermine a159 Edrophonium Viagra interaction Meridia diet Tramadol cash on delivery Pentamidine Vicodin for sale Mark martin uniform jacket team caliber viagra Phentermine no perscription needed Oxycodone Fioricet line Buy phentermine in the uk Viagra uses Mevacor Ritalin Eldepryl Viagra 100 mg Amitriptyline Viagra high blood pressure Buclizine Monopril Buy cheap uk viagra Method of payment accepted cod phentermine Aminopterin Phentermine for sale with out perscription Phentermine testimonials Avandia Lunesta Hydrocodone info Buy phentermine by cod Phentermine no rx Mazindol Order cheap phentermine Recreational viagra In use viagra woman Lamivudine Ambien eminem Stopping xanax Hydrocodone online pharmacy Diet diet dieting phentermine pill Cheap viagra canada Best price viagra Phentermine + sale Bendroflumethiazide Vinorelbine Buy cheap online viagra Phenyltoloxamine Anxiety panic disorder xanax Nifedipine Cheap prescription viagra Generic xanax Generic viagra cialis levitra buy cheap 5 no prescription Xanax description Ibuprofen Iproniazid Viagra canada Etanercept Generic viagra soft tab Is tramadol a narcotic Motrin Compare cialis levivia viagra Viagra sex Cheap viagra uk Ciprofloxacin Buy cheapest online place viagra Prednisolone Allopurinol Blindness cialis Phentermine perscription Phentermine without perscription Physostigmine Fda approved phentermine Xanax online pharmacy no prescription Fosamax Viagra jokes Cialis drug impotence Delivery florida online pharmacy phentermine Fiorinal Diet pill phentermine Add link phentermine purchase suggest Xanax next day delivery Free overnight phentermine shipping Femara Cefoperazone Phentermine ship to florida Buy cheap phentermine free fedex Amiloride Diphemanil Cialis prices Pharmacy phentermine sister Tolazoline Valium vicodin Effects of long term xanax use Hydrocortisone Cialis comparison viagra Order xanax overnight Lowest phentermine prices Aciphex Low dose xanax prosexual Buy online phentermine shipping Buy viagra online uk Viagra for sale Cheapest cialis generic Cheep phentermine with cod payments Didrex vs phentermine Phentermine with no prior prescription Acitretin Omeprazole Eulexin Astemizole d method Lomefloxacin Phentermine interactions Hydrochlorothiazide How does xanax work Chlortrimeton Generic sample viagra Purchase cialis Phentermine no consultation Chlorothiazide Canada xanax Acetohexamide Xanax and grapefruit Nicorette Imipenem Cheap phentermine online Relafen Cod tramadol Levallorphan Benztropine Submit a site viagra Mixing cocaine and viagra Do companies sell phentermine with low dose ingredients Nalorphine Hydrocodone withdrawal Etoposide Buy lvivhostcom online viagra viagra Effect viagra Buy cod online phentermine Meridia Doxycycline Estrace Phentermine prozac Glucotrol Order cialis uk Diet pills phentermine Carisoprodol Methyldopa Xanax american express Comparisons on online viagra suppliers Buy cheap domain onlinemiheyorg phentermine phentermine Zalcitabine Diet inexpensive phentermine pill Buy ambien Xanax drug tests Cheap phentermine cod Tramadol narcotic Phentermine lose weight loss diet pills Compare viagra prices Omnicef Viagra without a perscription Buy phentermine online prescription Buy phentermine cod Alprazolam xanax Saccharin Women viagra Femara Review of herbal phentermine Phentermine pill online discount Online viagra consultation Overnight tramadol Lisinopril with viagra Phentermine tablets Liotrix Celebrex Colon cleanse ambien Methotrexate 120 tramadol Free cialis Paxil Buy fioricet Terbutaline Bricanyl Vicodin effects Buy prescription tramadol without Discount cialis Picture of generic xanax Cheap phentermine without prescription Side effects of xanax Cleocin Vicodin side effects Accupril Calan Vicodin info Xanax during pregnancy Voltaren Benazepril Xanax precriptions Levivia dosing compared to viagra Dextroamphetamine Tolazamide Information phentermine Atenolol Cheapest viagra prices Xanax withdrawl message boards Viagra generico impotencia Bactrim Xanax paypal No perscription tramadol Herbal viagra for women Buying viagra on line Non perscription viagra Imdur Lisinopril Cheap diet online phentermine pill Foscarnet Buying viagra in the uk Generic viagra reviews Cilostazol Ansaid On line viagra Betaxolol Injecting xanax Buy online viagra where Cialis info Cortisone Cialis company Eon phentermine Viagra free pill Phentermine cheapest Flovent Tramadol medication Adapalene Permax Tramadol hcl 50mg Perscription phentermine Cialis comparison levitra Prescription xanax Information phentermine shortage Fioricet phentermine shipping Cephalexin Discount meridia Lexapro Xanax 1mg Viagra picture Cipro Phentermine success stories Non prescription phentermine Xanax withdrawal Arava Podophyllum Viagra commercials Cytarabine Phentermine Viagra libido Moxalactam Phentermine price comparison Lexapro Buying viagra online Menadione Viagra lawsuits Herbal viagra alternatives Orlistat Viagra price online Restless leg syndrome phentermine Online pharmacy phentermine xenical meridia Viagra online cheap Cheap fioricet Drug prescription tramadol Viagra cheap Buy online viagra securely Drug vicodin Phytonadione Phentermine discover card Famvir Black market viagra Compare phentermine prices Reglan Dioxyline Generic viagra in canada Bontril Online phentermine no prescription Cialis levitra better India generic viagra Xanax uses Pulmonary hypertension viagra Cod delivered phentermine Afrin Mannitol Clarithromycin Buy xanax no perscription needed amex accepted Soma san diego Chlorotrianisene Where can i buy viagra Phentermine withdrawal symptoms Zithromax Clorazepate Vicodin online pharmacy Diclofenac Zyban Viagra testimonials Treat crohns disease with viagra Generic money order viagra Generic cialis overnight Phentermine without a prescription Drug laws ohio diet phentermine Tramadol 100 mg no prescription Ampicilin Buy get online prescription viagra Cialis levitra viagra compare Buy cialis soft tabs Cialis Low natural resources for the drug phentermine Loss phentermine story success weight Online cialis Ursodiol Phentermine priority mail Celexa Pharmacy online phentermine Best phentermine pharmacies compare links Tocainide Viagra alternative and woman 25 mg Diet ky phentermine pill ship that Acyclovir Dulcolax Buy phentermine shipped usps Vasopressin Hydrocodone prescription online Cheap diet phentermine pill Drug screening phentermine Online pharmacy prescription viagra Acarbose Thiabendazole Nasalcrom Phencyclidine Botox Ethanol Cidofovir Free viagra order online Lanoxin Buy tramadol without prescription Viagra samples Imuran Adderall skin allegra skin xanax skin Phentermine online purchase Xanax long term effects Ambien 10mg Diet drug fenfluramine phentermine Enalapril Impotence treatment viagra Pheniramine Cialis versus viagra Xanax pills Dovonex Shipping phentermine to florida Buy locally viagra Overnight shipping phentermine Lysodren Canada online pharmacy viagra Phentermine overnight no perscription Wholesale phentermine Diethylpropion Nitroprusside Phenazopyridine Phentermine warning Phentermine cod overnight Loratadine Cheapest phentermine diet pills Celebrex Fentanyl Xanax side effect Ceftibuten Hydrocodone overnight Cefmetazole Erythrityl Minocycline Niacin Viagra cream for woman Klonopin vs xanax dosage Cialis dosage Piperidolate Order fioricet online Order buy phentermine online Ordering 30mg phentermine Atrovent Erectile dysfunction viagra Glyburide Effects from side viagra Bacitracin Buy vicodin without prescription Cordarone Xanax sexual side effects Order viagra buying viagra uk Trimethaphan Purchase tramadol online Thiotepa Phentermine cod Ingredient in phentermine Coreg Mephentermine Riboflavin Herbal viagra uk Cialis softtabs
break
Apr 24

Have you ever come across something like this? I had, and I thought it was something interesting to write about.

The scenario:
I was using the AJAX AutoCompleteExtender when I realized that inside the ServiceMethod of my AutoCompleteExtender, I needed to call a method that needed between it’s parameters an Enum.

To the ServiceMethod of an AutoCompleteExtender, you can pass parameters through the contextKey. Nonetheless I couldn’t pass an enum, so I decided to pass the name of the Database as an string, and then inside the ServiceMethod convert the string into an enum.

Anyways, this is how you convert a string into an enum:

private void Form1_Load(object sender, EventArgs e)
{
DataBase db = convertStringToEnum("Pubs");
MessageBox.Show(db.ToString());
}
private DataBase convertStringToEnum(string dbName)
{
return (DataBase)Enum.Parse(typeof(DataBase), dbName);
}
public enum DataBase
{
Northwind = 0,
Pubs = 1
}

If you have any questions, feel free to leave a comment.

Dec 19

Another easy but useful task: Read the names of different folders that are inside a directory. Reading the names is easy, but splitting the absolute path of the directory to only get the name of the folder, is a little bit more interesting.

I am using ASP.NET to do this:

Default.aspx

<form id=”form1″ runat=”server”>
<asp:listbox id=”ListBox1″ runat=”server”></asp:listbox>
</form>

I just declare a listbox inside the form.

Default.aspx.cs

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
foreach (string subDirectory in
System.IO.Directory.GetDirectories(
AppDomain.CurrentDomain.BaseDirectory))
{
// split the folders into an array of strings
string[] directory = subDirectory.Split(new char[] { '\\' });
// how many folders do we have?
int numOfDirectories = directory.Length;
// the last folder is the folder we are looking for
ListBox1.Items.Add(directory[numOfDirectories - 1]);
}
}
}

System.IO.Directory.GetDirectories as MSDN states: “Gets the names of subdirectories in the specified directory”. However, you get an absolute path of the directory.

If you would like to add the name of the folder to a listbox you will need to split the string that contains the different directories and store the directories in an array of strings:

string[] directory = subDirectory.Split(new char[] { ‘\\’ });

After this step, you get the amount of directories the absolute path has, and then look for the last directory in the array:

int numOfDirectories = directory.Length;
ListBox1.Items.Add(directory[numOfDirectories - 1]);

The directory I am using to read the files is AppDomain.CurrentDomain.BaseDirectory which is the base directory that the assembly resolver uses to search for assemblies.

The result of this snippet is:

Dec 18

The task: You have a string that is comma delimited , and you would like to sort that string and display it in a listbox.

I am using ASP.NET to do this:

Default.aspx

<form id=”form1″ runat=”server”>
<asp:listbox id=”ListBox1″ runat=”server”></asp:listbox>
</form>

I just declare a listbox inside the form.

Default.aspx.cs

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// the comma delimited list
string names = "Lesseps,Daniel,Isaacs,Diaz";
// split the string and make it an array of strings
string[] listOfNames = names.Split(new char[] { ',' });
// sort the array of strings
Array.Sort(listOfNames);
foreach (string name in listOfNames)
{
ListBox1.Items.Add(name);
}
}
}

The result:
sort an array of strings

In C#, it is extremely easy to sort an array of strings, just use:

Array.Sort(listOfNames);

where listOfNames is an array of strings.

Sep 1

This is the case scenario: if you have a form and in the form you have a button, if you press the button can you actually see a User Control displayed?. A friend of mine asked me this question because in his form he was trying to display a user control doing this:

private void button1_Click(object sender, EventArgs e)
{
UserControl1 userControl = new UserControl1();
userControl.Show();
}

This will not do the trick. What you need to do is to create a form, add the user control to the form, and then display the form. This is a simple way of doing this:

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void Show(Control control)
{
Form form = new Form();
form.Controls.Add(control);
form.Show();
}
private void button1_Click(object sender, EventArgs e)
{
UserControl1 userControl = new UserControl1();
Form1 form = new Form1();
form.Show(userControl);
}
}

At this point you will be able to see your user control displayed inside a form.

Jul 28

I have a dataGridView with two columns and multiple rows.

The task: When I pressed the enter key, in any of my dataGridViewCell I want to handle the fact that the user pressed the enter key. I will also get the value they typed.

In order to do this I was trying to simulate an event that Processes the ENTER key. I read about a DataGridView.ProcessEnterKey Method but this didn’t work quite well for me, considering I need to know the index of the current column of my dataGridViewCell.

So how can you simulate this?. First of all the first event that is going to be called is CellEnter. This is the code I have when the user enters the cell

private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
{
// store the index of the column
columnIndex = e.ColumnIndex;
dataGridView1.BeginEdit(false);
}

Then the next event that is going to be called is EditingControlShowing. This occurs when a control for editing a cell is showing. This is the code I have for this event:

private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
DataGridViewTextBoxEditingControl dText = (DataGridViewTextBoxEditingControl)e.Control;
dText.KeyUp -= new KeyEventHandler(dText_KeyUp);
dText.KeyUp += new KeyEventHandler(dText_KeyUp);
}

I create a DataGridViewTextBoxEditingControl (according to MSDN: “represents a text box control that can be hosted in a DataGridViewTextBoxCell” ) of the current cell, and remove and add to that control a KeyUp event, which is the next event that gets called.

The KeyUp event according to MSDN: “occurs when a key is released while the control has focus.”. The code for the KeyUp events looks like this:

void dText_KeyUp(object sender, KeyEventArgs e)
{
int rowIndex = ((System.Windows.Forms.DataGridViewTextBoxEditingControl)(sender)).
EditingControlRowIndex;
if (e.KeyCode == Keys.Enter)
{
object valueEntered = dataGridView1[columnIndex, rowIndex - 1].EditedFormattedValue;
MessageBox.Show("The Enter Key was detected. The value entered was: " + valueEntered.ToString());
}
}

At this point you can do something with the fact that the user pressed enter. I am displaying a Message Box with the value entered by the user.

If you know of another way, or a better way to do this , I’ll be very interested to know. At least this is the only way I found to solve this problem.

Here’s a copy of my files.

Jul 28

I had a dataGridView in which if I clicked a cell, it will look like this

before cell enter

I had to click the cell twice to get the focus.I wanted to click the dataGridViewCell and immediately get the focus. Something like this:

after cell enter

Clicking twice the dataGridViewCell to get the focus is annoying. This is the code that helped me to put the focus in the dataGridViewCell immediately:

private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
{
// puts the current cell in edit mode
dataGridView1.BeginEdit(false);
}

I would also like to thank Lisurc for his input in this topic. He had another solution to it, and it works just as good what is stated above. Thanks for your contribution Lisurc.

If you have another way to solve this problem, please comment it, and let me know.


private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
{
dataGridView1.EditMode = DataGridViewEditMode.EditOnEnter;
}

Jul 4

I was trying to add a value to a specific DataGridViewCell. To accomplish these you need to do something like this:

DataGridViewCell cellLotsOfAmount = monitorDataGrid[e.ColumnIndex, e.RowIndex];
cellLotsOfAmount.Value = lotsOfAmount;

This should do the work; however, there may be the case ( as it was happening to me ) that you are doing this inside a method, and for some reason, the value is not being displayed in the DataGridViewCell. I tried lots of things inside this method, that didn’t quite work for me.
If you search around different users will probably suggest to
- Invalidate the cell: monitorDataGrid.InvalidateCell(cell);
- Refresh edit the datagridview: monitorDataGrid.RefreshEdit();
etc,etc,etc

However, what actually worked for me, was to change the value of the cell inside the DataGridView.CellFormatting event. According to the MSDN library this occurs “when the contents of a cell need to be formatted for display.”

My code inside this event looks something like this:

private void monitorDataGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
// search for the column you are looking for
if (monitorDataGrid.Columns[e.ColumnIndex].HeaderText == "Lots of amount")
{
// get the cell you are looking for
DataGridViewCell cellLotsOfAmount = monitorDataGrid[e.ColumnIndex, e.RowIndex];
// change the value
cellLotsOfAmount.Value = lotsOfAmount;
}
}

Doing this I didn’t have invalidate or refresh the datagridview in order for my value to be displayed. This is how I solved this problem, if this helped you to solve it, or you have a different thought on this, I’ll be glad to know about it.

Jun 20

I actually do this a lot, here’s how:

foreach (DataGridViewRow gridrow in DataGridView.Rows)
{
DataRow datarow = (gridrow.DataBoundItem as DataRowView).Row;
// do something with the datarow
}

Jun 6

Lately, I have been putting my programming practices to the test with FxCop. FxCop makes sure your code conforms the best .NET coding practices.

I will write in a separate post how to use FxCop, but for the moment i will write about some of the improvements FxCop suggested for my code.

Warning, Certainty 95, for UseLiteralsWhereAppropriate
{
Resolution : “Field ‘MOST_ACTIVE’ is declared as ’static readonly’
but is initialized with a constant value ‘Most Active’.
Mark this field as ‘const’ instead.”
}

The line that was causing this warning:
private static readonly string MOST_ACTIVE = “Most Active”;
Solution:
private const string MOST_ACTIVE = “Most Active”;

Warning, Certainty 95, for TestForEmptyStringsUsingStringLength
{
Resolution : “Replace the call to String.op_Inequality(String.Empty)
in ‘MyDefaultPage.Populate(String, String):Void’ with
a call to String.IsNullOrEmpty.”
}

The line that was causing this warning:
if (panel != String.Empty)
Solution:
if (!String.IsNullOrEmpty(panel))

Warning, Certainty 90, for DoNotInitializeUnnecessarily
{
Resolution : “MyDefaultPage.MyDefaultPage() initializes field
behavior of type DeltaOptions.Windows.Forms.Behaviour.IReportFormBehavior
to null. Remove this initialization as it will be done
automatically by the runtime.”
}

The line that was causing this warning:
private IReportFormBehavior behavior = null;
Solution:
private IReportFormBehavior behavior;

Warning, Certainty 95, for RemoveUnusedLocals
{
Resolution : “MyDefaultPage.Populate():Void declares a local,
‘mypageOptions’, of type System.String, which is never
used or is only assigned to. Use this local or remove
it.”
}

The line that was causing this warning:
Some variable that wasn’t being used in a method
Solution:
Delete or comment the variable not used.

These are some of the multiple warnings that FxCop can point about your code. As you noticed, running your code against this tool will improve your source code greatly.

Jun 5

Today I’ve been wondering how to set a DataGridViewComboBoxColumn to a default value. The reason I wanted do this, is because i want the combo box to have a default value when the datagridview is loaded in the screen.

The line to accomplish this is the following:

DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn();
cmb.DefaultCellStyle.NullValue = "Buy";

« Previous Entries