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
    )

  • 相关阅读:
    IMX6ULL开发板虚拟机eVMware的安装
    IMX6ULL开发板Ubuntu系统初体验之登录设置
    itop4412开发板QtE4.7UVC摄像头使用例程
    iTOP4412开发板android4.4代码下载和编译
    IMX6ULL开发板之Ubuntu常用命令(二)
    IMX6ULL开发板aptget软件下载工具
    4412开发板编译ARMqtopiafreesrc2.2.0常见错误的处理
    IMX6ULL开发板虚拟机安装Ubuntu系统
    伟大的程序员是怎样炼成的?
    Created field method on datasource in AX Form
  • 原文地址:https://www.cnblogs.com/gaitian00/p/2202421.html
Copyright © 2011-2022 走看看