zoukankan      html  css  js  c++  java
  • zhao

    (
    rollout rollmain "dotnet"
    (
    dotnetcontrol lst_test "System.Windows.Forms.Listbox" 290 height:290 align:#center
     
    on rolmain open do
    (
    dotnet.loadassembly "System.Data"
     
    constring="data source=.\SQLEXPRESS;Initial Catalog=YOUR_DATABASE_HERE;Integrated Security=True;Connect Timeout=30"
    con=dotnetobject "System.Data.SqlClient.SqlConnection" constring
     
    dataset=dotnetobject "System.Data.Dataset"
    tableadapter=dotnetobject "System.Data.SqlClient.SqlDataAdapter" "SELECT * FROM tasks" constring
     
    tableadapter.Fill dataset "tasks"
     
    --At this point you have your data into the dataset created before
    --Now the problem seems to be with the listbox databinding... cant understand why
     
    lst_test.Datasource=dataset.tables["tasks"]
    lst_test.DisplayMember="taskname" --This is the column name used for displaying data and I thing the problem is here somewhere...
    lst_test.ValueMember="id_task" -- Primary key column
     
    --if you want to confirm the data in your dataset you could do this loop. This shows that the problem is not getting the data into the dataset but displaying it in the listbox
     
    for i=0 to dataset.tables["tasks"].rows.count do -- it's this or dataset.tables["tasks"].rows.items.count, can't quite remember
    (
    print dataset.tables["tasks"].rows.item[i].item["taskname"] --I'm not sure about this one, but a ShowProperties on dataset.tables["tasks"] should help a little
    )
     
    )
    )
    createdialog rollmain 300 300
    )

    rollout test "Test"
     (
      dotNetControl tb "system.windows.forms.textBox" height:80
      
      on test open do
      (
       tb.multiLine=true
       sb=dotNetClass "System.Windows.Forms.ScrollBars"
       tb.scrollBars=sb.vertical
       tb.acceptsReturn=true
       tb.acceptsTab=true
       tb.wordWrap=true
       tb.focus()
      )
     )
     createDialog test

     frmMain = dotNetObject "System.Windows.Forms.Form"
    frmMain.Show()


    (
     -- Create TextBox
     hTextBox = dotNetObject "System.Windows.Forms.TextBox"
     hTextBox.Location = dotNetObject "System.Drawing.Point" 10 10
     hTextBox.Width = 280
            hTextBox.Height = 280
     hTextBox.Visible = true
     hTextBox.MultiLine = true
     ScrollBars = dotNetClass "System.Windows.Forms.ScrollBars"
     hTextBox.ScrollBars = ScrollBars.Vertical
     hTextBox.AcceptsReturn = true
     hTextBox.AcceptsTab = true
     hTextBox.WordWrap = true
     
     -- Create Form
     hForm = dotNetObject "System.Windows.Forms.Form"
     hForm.Size = dotNetObject "System.Drawing.Size" 310 335
     hForm.Text = ".Net 2.0 Form with TextBox"
     hForm.Controls.Add(hTextBox)
     hForm.TopMost = true
     FormBorderStyle = dotNetClass "System.Windows.Forms.FormBorderStyle"
     hForm.FormBorderStyle = FormBorderStyle.FixedDialog
     hForm.ShowInTaskbar = false
     hForm.MinimizeBox = false
     hForm.MaximizeBox = false
     
     -- Set appropriate Form background color
     maxBackColor = colorMan.getColor #background
     Color = dotNetClass "System.Drawing.Color"
     hForm.BackColor = Color.FromArgb (maxBackColor[1] * 255.0f) (maxBackColor[2] * 255.0f) (maxBackColor[3] * 255.0f)
       
     -- Show application Form
     hApp = dotNetClass "System.Windows.Forms.Application"
     hApp.Run hForm
    )

  • 相关阅读:
    OpenCvSharp 识别颜色
    树莓派 Raspberry Pi 4,.net core 3.0 ,Avalonia UI 开发
    iis频繁奔溃,分析dump
    prerender.io 搜索引擎优化 部署成windows服务 实现开机自动开启服务
    ionic3包还原使用yarn命令执行步骤(解决ionic3懒加载报找不到 module的错误)
    firebreath 在谷歌和火狐浏览器下的调试 以及打包
    ASP.NET Web API 2 对 CORS 的支持
    .net mvc通过ucenter和 discuz的整合,nopcommerce ucenter 插件的方式实现
    EF + Mysql
    Jenkins持续集成 & .NET
  • 原文地址:https://www.cnblogs.com/gaitian00/p/2202421.html
Copyright © 2011-2022 走看看