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
    )

  • 相关阅读:
    未来行业
    百度网盘搜索方法
    JavaScript继承详解
    Win 7下破解Loadrunner 11(带中文版下载地址)
    NET下RabbitMQ实践[WCF发布篇]
    NET下RabbitMQ实践[示例篇]
    NET下RabbitMQ实践[配置篇]
    8个超炫的 Web 效果
    Windows下安装zip包解压版mysql
    键盘上相当于鼠标右键的快捷键和电脑快捷键大全
  • 原文地址:https://www.cnblogs.com/gaitian00/p/2202421.html
Copyright © 2011-2022 走看看