Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

al3xutzu00

@al3xutzu00
About
Posts
21
Topics
12
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • ASP.NET C# set GridView Column htmlencode to false from C#
    A al3xutzu00

    Hi Experts, I have an issue with the GridView for wich I want to set a column htmlencode property to false. Here is the data source. I have no databound columns because I'm not using SQLDataSource.

    public void LoadStories()
    {
    SqlConnection con = new SqlConnection("Data Source=dpeta-ro;Initial Catalog=MINTPRINT;Integrated Security=True");
    SqlCommand cmdSelect = new SqlCommand("select news_id \"id\", title \"title\", news_text \"story\", created_date \"created on\", active from news", con);
    SqlDataReader rd;

            try
            {
                con.Open();
                rd = cmdSelect.ExecuteReader();
                gwNews.DataSource = rd;
                gwNews.DataBind();
                con.Close();
            }
            catch (Exception err)
            {
                lblError.Text = err.Message;
                con.Close();
            }
        
        }
    

    The news_text column has HTML code that i want the GridView to render as HTML code, without encoding it. Because the GW has the Encode set to true by default i need to change it dynamically. Any ideas? Thank you, Alex

    “Be the change you want to see in the world.”

    C# csharp html asp-net security help

  • delete rows in listView using KeyPressed event and Delete Key
    A al3xutzu00

    Thank you Christian, it works perfect with KeyDown and e.KeyCode. Here is the implementation :

        private void listView1\_KeyDown(object sender, KeyEventArgs e)
        {
            if (listView1.SelectedItems.Count != 0 && e.KeyCode == Keys.Delete)
            {
    
                while (listView1.SelectedIndices.Count > 0)
                {
                    listView1.Items.RemoveAt(listView1.SelectedIndices\[0\]);
                }
            }
        }
    

    “Be the change you want to see in the world.”

    C# question com

  • delete rows in listView using KeyPressed event and Delete Key
    A al3xutzu00

    Hi Guys, I have been trying to implement the KeyPress event on a listView so that when i use the DELETE key, i will delete the selected rows (MultiSelect=true) The code works fine when i use a button to call it from :

        private void btnDeleteRow\_Click(object sender, EventArgs e)
        {
            while (listView1.SelectedIndices.Count > 0)
            {
                listView1.Items.RemoveAt(listView1.SelectedIndices\[0\]);
            }
        }
    

    However in MSDN documentation it is explicitly said that e.KeyChar can't be used for DELETE and several other special function keys like F1-F12 , PageUp etc... http://msdn.microsoft.com/en-us/library/system.windows.forms.keypresseventargs.keychar.aspx[^] How can i use the DELETE KEY to delete items in listViews? Kind regards, Alex:confused:

    “Be the change you want to see in the world.”

    C# question com

  • Deserialization Issue
    A al3xutzu00

    Hello Guys, I have an issue with Deserialization. I have 2 Projects and I want to extport data to a binary file (serialize) in the first Project, and i want to read that date using the second application Deserialize. The first Aplication will be given to hte end user, and will generate a Binary file that i want to read using the Admin application (the second one). When i try to deserialize i receive this error: "Unable to find assembly 'Application Timing', Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'." I think i know the cause of the issue. The binary formatter puts the Application name,version and info in the file when it serilizes it, but i don't know how to bypass this. Any suggestions?:confused: Kind regards, Alex

    “Be the change you want to see in the world.”

    C# help tutorial question announcement

  • Oracle DB Querry Application Error
    A al3xutzu00

    Hi Guys, I want to insert in a list view all the Table Names from a Oracle DB. I started by learning how from Syed M Hussain 's post : A Very Simple Oracle Query Tool[^] using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; ..... static private OracleConnection orcCon; private static OracleCommand cmd; private static OracleDataAdapter da; private static OracleCommandBuilder cb; private static DataSet ds; private static String sql; ..... public static DataTable GetUserTables() { sql = "SELECT TABLE_NAME FROM USER_TABLES"; cmd = new OracleCommand(sql, OrcCon); cmd.CommandType = CommandType.Text; da = new OracleDataAdapter(cmd); cb = new OracleCommandBuilder(da); ds = new DataSet(); da.Fill(ds); return ds.Tables[0]; } ........... dtTable = Code.ConectareOracle.GetUserTables(); for (int i = 0; i < dtTable.Rows.Count; i++) { MessageBox.Show(dtTable.Rows[i].ToString()); } .... ..and the error i get is that da.Fill(ds) has : "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Any ideea? Kind regards, Alex

    “Be the change you want to see in the world.”

    C# database oracle com performance help

  • ListView - Select ListViewItem
    A al3xutzu00

    Thanks a lot Dan. This worked perfectly. Alex :)

    “Be the change you want to see in the world.”

    C# tutorial question

  • ListView - Select ListViewItem
    A al3xutzu00

    thanks man for the advice. I dont know what "FOAD" means but "FOAD" to you as well for helping me:D Regards, Alex

    “Be the change you want to see in the world.”

    C# tutorial question

  • ListView - Select ListViewItem
    A al3xutzu00

    Hi, I have a list view with 5 columns and 4 items in that listView. When i click on a row ( item) of that listViewi want the whole row to be highlighted blue , and if i select another row, what that it to be selected as well. So basically i want it to look like the whole row is selected not just the first column item. here is what i tried : private void listView1_Click(object sender, EventArgs e) { for (int i = 0; i < listView1.Items.Count; i++) { if (listView1.Items[i].Selected == true) { listView1.Items[i].BackColor = Color.Blue; } } } BUT this works after I change the selection of the row! for example i select row 1 , and when i select row 2 , then row 1 is highlited . Why guys? Any suggestions please? Regards, Alex

    “Be the change you want to see in the world.”

    C# tutorial question

  • ListView
    A al3xutzu00

    Hi, How do i select the whole listViewItem line (all the subitems of an item) when trying to copy it in the clipboard? I have a listView with 5 columns. When i try to select 1 row it only selects the first column value not the whole row.. any ideas? Regards, Alex

    “Be the change you want to see in the world.”

    C# question

  • Printing Question - characters per line
    A al3xutzu00

    Sorry , you are right , my bad. i tried this : float characterPerLine = e.MarginBounds.Width/printFont.Size; and it worked. but it still is not einough... I know that i shoud devide the widith of the line with the widith of the font but there is no printFont.GetWidith in c# intelisense.

    “Be the change you want to see in the world.”

    modified on Tuesday, May 5, 2009 3:24 PM

    C# question graphics

  • Printing Question - characters per line
    A al3xutzu00

    Hi Guys, I am trying to print some items from a listview. I read the whole listview item in a String and then i try to see how many characters i can write on a line of the page that i want to print one :

    public void pd_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
    {
    ...
    float characterPerLine = e.MarginBounds.Width/printFont.GetHeight(e.Graphics);
    ...
    }

    but this is not returning me the correct number. The question is ... how can i calculate the number of characters per line when printing? Kind regards, Alex

    “Be the change you want to see in the world.”

    C# question graphics

  • List view question
    A al3xutzu00

    10x a lot :) it works fine:):D I should of thought of that :D Regards, Alex

    “Be the change you want to see in the world.”

    C# question json tutorial

  • List view question
    A al3xutzu00

    Hi guys, I have a list view that i want to to clear so that i can import data from a serialized file in it. i use the listview1.Clear() command that clears also the column headers, and the de-serialization doesn't work without the column headers. I have tried before the Clear() method this code : System.Windows.Forms.ListView.ColumnHeaderCollection coloane = listView1.Columns; foreach (ColumnHeader header in coloane) { listView1.Columns.Add(header.Text); } listView1.Clear(); and still it doesn't work. Any suggestions on how to clear a ListView without the colum headers ? Regards, Alex

    “Be the change you want to see in the world.”

    C# question json tutorial

  • overload operator +
    A al3xutzu00

    Thanks a lot. It worked just fine:D here it is: public static PresaHidraulica operator +(PresaHidraulica p, Revizie r) { p.ListaRevizii.Add(r); return p; } Regards, Alex

    “Be the change you want to see in the world.”

    C# question help

  • overload operator +
    A al3xutzu00

    Hi guys, Quick question: I got this class: public class PresaHidraulica { ..... public System.Collections.ArrayList listaRevizii; } and i want to overload the operator + to add an object of another class(Revizie) in this ArrayList from this class. I tried : public static PresaHidraulica operator +(Revizie r1) { } And i get the error : The parameter of a unary operator must be the containing type Any suggestions please? Regards, Alex

    “Be the change you want to see in the world.”

    C# question help

  • Operator[] index overload in C#
    A al3xutzu00

    Hi Guys, I need to make an overload for the index operator[int x] for an System.Collection.ArrayList, to use the get/set methods on it to return/set the specific item in that list. How do i declare it ? i tried : public static explictit operator[int x] { } It doesn't work. Help. Kind regards, Alex

    “Be the change you want to see in the world.”

    C# question csharp database help

  • Delegates in C#
    A al3xutzu00

    10x for the advice Rob. My delegate works just as it is. The issue is that Form1 is the first that starts when i run the program . In form 2 i have the button to print ( with the code). To avoid copying the same code in Form1, i wanted to create a delegate. So i created it in Form2 and also subscribed the print preview method to in in Form2. I made it but it only works when i start Fom1 and then start form2 and close it. Then i can use the button in Form1 for print preview. This is because when i use the starter method in Form1 for the button in the Menu Strip i run it like this :

        private void printPreviewToolStripMenuItem\_Click(object sender, EventArgs e)
        {
            **Form2**.StarterPrintPreview(sender, e);
        }
    

    So it needs form2 started once in order to run...and i am struggling with this to make it work :( PS:I declared the Methods in Form2 STATIC but i can't see them in form1.i need to call them using FORM2

    “Be the change you want to see in the world.”

    C#

  • Delegates in C#
    A al3xutzu00

    Hi Guys, Quick question : I have 2 forms : FORM1 and FORM2. In FORM1 i am trying to implemen a PRINT PREVIW button to work like the PRINT PREVIW button in FORM2. Here is the delegate, event Starter() and Subscriber() lines.

    public delegate void DelegatPrintPreview(object sender, EventArgs e);
    public static event DelegatPrintPreview EvenimentDelegatPrintPreview;

        public static void StarterPrintPreview(object o, EventArgs ev)
        {
            if (EvenimentDelegatPrintPreview != null)
            {
                EvenimentDelegatPrintPreview(o, ev);
            }
        }
        public static void SubscribeToPrintPreview(DelegatPrintPreview pf)
        {
            EvenimentDelegatPrintPreview += new DelegatPrintPreview(pf);
        }
    

    the question is : Where do i put the delegate(in the form with the same button or the other one )? and the same question with the Starter() and Subscriber() methods ? Regards, Alex

    “Be the change you want to see in the world.”

    C#

  • Using StreamWriter...... Help Guys [modified]
    A al3xutzu00

    Try using this code:

        private void btnSave\_Click(object sender, EventArgs e)
        {
            FileDialog salvareFisier = new SaveFileDialog();
            salvareFisier.Filter = "Text files (\*.txt)|\*.txt";
            if (salvareFisier.ShowDialog() == DialogResult.OK)
            {
                FileStream fisier = new FileStream(salvareFisier.FileName, FileMode.Create, FileAccess.Write);
                   
                    addText(fisier,"your \_text \_ here ");
                    addText(fisier, "\\r\\n");
    
                fisier.Close();
            }
            else
                MessageBox.Show("Data has not been saved");
        }
    
        public static void addText(FileStream f, string valoare)
        {
    
            byte\[\] info = UTF8Encoding.Default.GetBytes(valoare);
            f.Write(info, 0, info.Length);
        }
    

    Regards, Alex

    C#

  • Datagridview comboboxcolumn question
    A al3xutzu00

    Hi, After you have initialized the combo box with values try using this :

    [combo_box_name].SelectedItem = [value];

    . (without the brackets):) It works for me. Is this what you were asking? Regards, Alex

    C#
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups