小编cle*_*ech的帖子

将QueryString ID从aspx页面传递到winform文本框

我目前正在开发一个调用winform的aspx页面.手头的问题是将文本框变量从网页传递到ProcessStartInfo事​​件,再到winform文本框以检索图像.查看者来自供应商,但仅适用于winform环境,但其他信息来自CF页面,href和非功能性Web图像查看器.我正在做什么?

Aspx页面代码:

namespace ImageView
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void page Load(object sender, EventArgs e)
        {
            TextBox1.Text = Request.QueryString["DKT_ID"].ToString();
            //TextBox2.Text = Request.QueryString["Name"].ToString();
            //TextBox3.Text = Request.QueryString["Age"].ToString();

ProcessStartInfo psi = new ProcessStartInfo(@"C:\ImageViewer\ImageView.exe");
            psi.WindowStyle = ProcessWindowStyle.Normal;

            Process p = new Process();
            p.EnableRaisingEvents = true;
            p.Exited += new EventHandler(MyExited);
            p.StartInfo = psi;
            p.Start();
        }
Run Code Online (Sandbox Code Playgroud)

Winform代码:

        //SQL section for returning images
        #region "Images Query"

        ImageQuery = "SELECT isn AS isn ";
        ImageQuery += "FROM bc_bcc_document (NOLOCK) ";
        ImageQuery += "WHERE barcode_id …
Run Code Online (Sandbox Code Playgroud)

c# asp.net parameters winforms

2
推荐指数
1
解决办法
1060
查看次数

在读取XML时在IEnumerable中构建Try-Catch

运行这个特定的代码块时,我在XML中遇到异常.我已经建立了一个try-catch,但是VS2010说"'WindowsFormsApplication1.Form1.GetDocumentsData(string)':并非所有代码路径都返回一个值".例外范围从空值到XML格式化异常.我只需要捕获它们并将它们记录到一个文件中(代码的一部分尚未完成).

C#代码:

    private static IEnumerable<object[]> GetDocumentsData(string folderPath = @"filepath")
    {
        try
        {
            return Directory.GetFiles(folderPath, "*.xml")
               .Select(XDocument.Load)
               .SelectMany(file => file.Descendants().Where(e => e.Name.LocalName == "FilingLeadDocument").Concat(file.Descendants().Where(e => e.Name.LocalName == "FilingConnectedDocument")))
               .Select(documentNode =>
               {
                   var receivedDateNode = documentNode.Elements().FirstOrDefault(e => e.Name.LocalName == "DocumentReceivedDate");
                   var descriptionNode = documentNode.Elements().FirstOrDefault(e => e.Name.LocalName == "DocumentDescriptionText");
                   var metadataNode = documentNode.Elements().FirstOrDefault(e => e.Name.LocalName == "DocumentMetadata");
                   var registerActionNode = metadataNode.Elements().FirstOrDefault(e => e.Name.LocalName == "RegisterActionDescriptionText");

                   return new object[]
  {
       (string)documentNode.Parent.Parent.Elements().FirstOrDefault(e => e.Name.LocalName == "DocumentIdentification"),
       (DateTime?)receivedDateNode.Elements().FirstOrDefault(e => e.Name.LocalName == "DateTime"),
       descriptionNode != null ? …
Run Code Online (Sandbox Code Playgroud)

c# xml try-catch

1
推荐指数
1
解决办法
570
查看次数

标签 统计

c# ×2

asp.net ×1

parameters ×1

try-catch ×1

winforms ×1

xml ×1