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
    )

  • 相关阅读:
    关于yyyy-MM-dd格式日期字符串,解析成LocalDateTime遇到的问题
    idea设置代码提示不区分大小写
    不错的Django技术网址
    Django-Rest-Framework 教程: 快速入门
    Djanto static静态文件配置
    Html5 touch event
    Zepto.js touch模块深入分析
    Python单元测试框架之pytest -- fixtures
    Python:高级主题之(属性取值和赋值过程、属性描述符、装饰器)
    Nginx基本配置、性能优化指南
  • 原文地址:https://www.cnblogs.com/gaitian00/p/2202421.html
Copyright © 2011-2022 走看看