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
    )

  • 相关阅读:
    (转载)自己实现spring
    重装mysql步骤
    华为过滤字符串(java)
    华为 去掉最大最小值
    Class.forName()数据库驱动
    线程中Join的使用例子
    基数排序的总结
    javaweb要点复习 jsp和servlet
    Qt实现360安全卫士10.0界面(编译时出现的一些问题)
    VS2010 添加资源文件后,出现 “LNK1123: 转换到 COFF 期间失败: 文件无效或损坏”错误
  • 原文地址:https://www.cnblogs.com/gaitian00/p/2202421.html
Copyright © 2011-2022 走看看