Click here to Skip to main content
15,891,136 members
Home / Discussions / C#
   

C#

 
Questionlocking an app on request Pin
Member 116417407-Oct-15 23:32
Member 116417407-Oct-15 23:32 
AnswerRe: locking an app on request Pin
Dave Kreskowiak8-Oct-15 3:28
mveDave Kreskowiak8-Oct-15 3:28 
AnswerRe: locking an app on request Pin
BillWoodruff8-Oct-15 19:47
professionalBillWoodruff8-Oct-15 19:47 
QuestionHow do I set a DataGridVew column in a ListView BOLD? Pin
Robert Oujesky7-Oct-15 11:10
Robert Oujesky7-Oct-15 11:10 
AnswerRe: How do I set a DataGridVew column in a ListView BOLD? Pin
Matt T Heffron7-Oct-15 12:26
professionalMatt T Heffron7-Oct-15 12:26 
AnswerRe: How do I set a DataGridVew column in a ListView BOLD? Pin
CHill607-Oct-15 13:01
mveCHill607-Oct-15 13:01 
GeneralRe: How do I set a DataGridVew column in a ListView BOLD? Pin
Robert Oujesky8-Oct-15 5:44
Robert Oujesky8-Oct-15 5:44 
GeneralRe: How do I set a DataGridVew column in a ListView BOLD? Pin
CHill608-Oct-15 6:20
mveCHill608-Oct-15 6:20 
GeneralRe: How do I set a DataGridVew column in a ListView BOLD? Pin
Robert Oujesky8-Oct-15 6:28
Robert Oujesky8-Oct-15 6:28 
GeneralRe: How do I set a DataGridVew column in a ListView BOLD? Pin
CHill608-Oct-15 6:34
mveCHill608-Oct-15 6:34 
QuestionAlert message script Pin
Member 120161066-Oct-15 15:31
Member 120161066-Oct-15 15:31 
AnswerRe: Alert message script Pin
Richard Andrew x646-Oct-15 16:22
professionalRichard Andrew x646-Oct-15 16:22 
GeneralRe: Alert message script Pin
Member 120161066-Oct-15 16:31
Member 120161066-Oct-15 16:31 
AnswerRe: Alert message script Pin
Richard Andrew x646-Oct-15 16:36
professionalRichard Andrew x646-Oct-15 16:36 
GeneralRe: Alert message script Pin
Member 120161066-Oct-15 16:53
Member 120161066-Oct-15 16:53 
AnswerRe: Alert message script Pin
Afzaal Ahmad Zeeshan6-Oct-15 22:12
professionalAfzaal Ahmad Zeeshan6-Oct-15 22:12 
GeneralRe: Alert message script Pin
Member 120161066-Oct-15 23:04
Member 120161066-Oct-15 23:04 
Thank you for kind sharing.
I wanted to display files from server to list box. I also wanted to put search button to search the files. the search button must be search from all directories or subfolders. if the file not exist in the server it must show an alert message.
Now, my problem is I do not know how to show alert message in c#...Could you pls help...

asp.net code:
XML
<asp:TextBox ID="txtbox_clotho" placeholder="Search by Mac Address" runat="server" Height="21px" style="margin-left: 45px" Width="217px" BorderColor="#333333" BorderStyle="Solid" ></asp:TextBox>
            <br />
            <asp:Button ID="btn_search" runat="server" BackColor="#006699" BorderColor="Black" BorderStyle="Groove" Font-Bold="True" Font-Size="Medium" ForeColor="White" OnClick="btn_search_Click" style="z-index: 1; left: 279px; top: 58px; position: absolute; height: 30px; width: 74px" Text="Search" />
            <br />
            <br />
            <asp:ListBox ID="lstbox_clotho" runat="server" Height="81px" style="margin-left: 47px" Width="245px"   ></asp:ListBox>
            <asp:ImageButton ID="imgbtn_dwn" runat="server" ImageUrl="~/images/download.png" Height="49px" Width="50px" OnClick="imgbtn_dwn_Click"  />
            <br />


c# code:
<pre lang="cs">using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

namespace wsmfgit
{

        /// &lt;display files in listbox from directory&gt;
    public partial class downloadsoftware : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {



                DirectoryInfo info = new DirectoryInfo(@&quot;\\192.168.5.10\fbar\TOOLS\ProbingApps\ProbingSystem\DesktopCopyTemp&quot;);
                FileInfo[] Files = info.GetFiles(&quot;*.*&quot;);
                foreach (FileInfo file in Files)
                {
                    ListBox1.Items.Add(file.Name);
                }

        }
         ///&lt;/display&gt;
        /// &lt;link to home button&gt;
        protected void imgbtn_home_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect(&quot;default.aspx&quot;);
        }
        ///&lt;/link&gt;
        ///&lt;software download button1&gt;
        protected void btn_dwn_Click(object sender, EventArgs e)
        {
            string File = ListBox1.SelectedValue;

            Response.ContentType = ContentType;
            Response.AppendHeader(&quot;Content-Disposition&quot;, &quot;attachment; filename=&quot; + Path.GetFileName(File));
            Response.End();
        }
        /// &lt;/software&gt;

        protected void btn_search_Click(object sender, EventArgs e)
        {
            lstbox_clotho.Items.Clear();
            string search = txtbox_clotho.Text;

            {
                string[] licfiles = Directory.GetFiles(@&quot;\\192.168.5.10\fbar\TOOLS\ProbingApps\ProbingSystem\Clotho_License&quot;, &quot;*&quot; + txtbox_clotho.Text + &quot;*.lic&quot;, SearchOption.AllDirectories);
                foreach (string file in licfiles)
                {
                    lstbox_clotho.Items.Add(new ListItem(Path.GetFileName(file), file));
                }

                {
                    txtbox_clotho.Text = &quot;&quot;;
                }
            }

        }
        protected void imgbtn_dwn_Click(object sender, ImageClickEventArgs e)
        {
            string licfiles = lstbox_clotho.SelectedValue;

            Response.ContentType = ContentType;
            Response.AppendHeader(&quot;Content-Disposition&quot;, &quot;attachment; filename=&quot; + Path.GetFileName(licfiles));
            Response.End();
        }
    }
    }
</pre>


Thank you.
GeneralRe: Alert message script Pin
Afzaal Ahmad Zeeshan6-Oct-15 23:18
professionalAfzaal Ahmad Zeeshan6-Oct-15 23:18 
Generalabout backend Pin
bittuu6-Oct-15 8:51
bittuu6-Oct-15 8:51 
GeneralRe: about backend Pin
dlhale6-Oct-15 8:56
dlhale6-Oct-15 8:56 
GeneralRe: about backend Pin
Mycroft Holmes6-Oct-15 14:17
professionalMycroft Holmes6-Oct-15 14:17 
GeneralRe: about backend Pin
bittuu6-Oct-15 19:00
bittuu6-Oct-15 19:00 
QuestionWhat happen when use 2 timer on a form. Pin
LeHuuTien5-Oct-15 21:13
LeHuuTien5-Oct-15 21:13 
AnswerRe: What happen when use 2 timer on a form. Pin
Pete O'Hanlon5-Oct-15 21:29
mvePete O'Hanlon5-Oct-15 21:29 
QuestionMessage Removed Pin
5-Oct-15 6:49
professionalN_tro_P5-Oct-15 6:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.