我希望能为我的背景工作者提供一些帮助,因为我无法让它工作.基本上我有一个背景工作者,它完成一些任务,但我正在尝试实现进度条和标签.我将进度条的最大值设置为10,然后随着每个任务的移动更新它,我也想到一个带有进度条的标签,它将显示进度,即
Pb value = 2
20% completed
Pb value = 6
60% completed
Run Code Online (Sandbox Code Playgroud)
等等.
到目前为止,我有这个编码.
更新*谢谢你的帮助.
那么,一个简单的问题是,工作事件会是这样吗?
Private Sub BGWorker_DoWork(ByVal sender As Object, _
ByVal e As DoWorkEventArgs) _
Handles BGWorker.DoWork
For i as Integer = 1 to 2
'My task code 1
BGWorker.ReportProgress(i)
Next
For i as Integer = 3 to 4
'My task code 2
BGWorker.ReportProgress(i)
Next
For i as Integer = 5 to 6
'My task code 3
BGWorker.ReportProgress(i)
Next
For i as Integer = 7 to …Run Code Online (Sandbox Code Playgroud) 我是VB.net的新手并创建一个应用程序,以便用户需要登录用户名和密码.
我正在使用SQL Server Compact Edition数据库.
这是我完美的代码: -
Imports System.Data.SqlClient
Imports System.Data.SqlServerCe
Public Class frm_edit_patient
Dim con As New SqlCeConnection
Try
Dim SQLquery As String
Dim da As SqlCeDataAdapter
Dim ds As New DataSet
Dim myConString As String = My.Settings.Database1ConnectionString
con.ConnectionString = myConString
MsgBox("Database is now open")
MessageBox.Show("connected")
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
Run Code Online (Sandbox Code Playgroud)
上面的代码工作正常,并告诉我 connected
但是当我添加这段代码时
SQLquery = "SELECT id FROM user where username=John Doe"
da = New SqlCeDataAdapter(SQLquery, con)
da = New SqlCeDataAdapter(SQLquery, con)
da.Fill(ds, "db1") …Run Code Online (Sandbox Code Playgroud) 我很难将WONum插入到我的sql字符串中.我试过在WONum周围使用'和double'.有人还建议#和[]围绕它,但到目前为止没有任何工作.
我一直收到以下错误:'1577'附近的语法不正确
在运行期间,WONum值实际上是WO-1577,但是当执行DA.fill时,我得到了该错误.我开始认为破折号在sql中做了一些我不知道的事情.任何帮助都会有所帮助,因为我必须在我的应用程序中执行几个类似的功能.
Public Function GetTechTimes(ByVal WONum As String)
Dim strSQL As String = "Select customer_name, workorder_work_to_be_performed, workorder_work_performed, workorder_notes, workorder_warranty_work, workorder_open_date, workorder_status,workorder_completion_date, wo_tech_name, wo_tech_time, wo_parts_description from Customers, workorders, WorkOrder_Technicians, WorkOrder_Parts Where(customer_id = workorder_customer And wo_tech_wo_id = workorder_id And wo_parts_wo_id = workorder_id And workorder_number = " & WONum & ""
Dim DA As New SqlDataAdapter(strSQL, Conn)
Dim DS As New DataSet
DA.Fill(DS, "TechTimes")
Return DS
End Function
Run Code Online (Sandbox Code Playgroud) 如何更改listview中项目的前景(甚至是后台会做).我有一个程序打开excel并检查给定表单中的断开链接.我想向用户显示给定链接的列表,而且这些链接已被破坏.我想将前景改为RED.我将这些值绑定到了observablecollection.该集合只是字符串的集合(WEB LINKS),并且工作正常
我应该像这里做多重绑定吗?
编辑: - 还有一个问题.创建属性并进行所有更改后.WPF表单没有使用值进行更新.即列表框没有填满.着色都没有发生(不确定它是否也在发生.我无法看到它们).
这是我的代码.请原谅我的编码,我是WPF的新手
<Window x:Class="URLValide.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:Local="clr-namespace:URL_Validater.URLValide"
Title="URL Validator" Height="269" Width="525" FontSize="13"
ResizeMode="NoResize">
<Window.Resources>
<ResourceDictionary>
<Style x:Key="HighLight" TargetType="{x:Type Control}">
<Setter Property="Background" Value="Honeydew"/>
<Setter Property="FontWeight" Value="UltraBlack"/>
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect BlurRadius="40" Color="Beige" Direction="50" Opacity="0.5"/>
</Setter.Value>
</Setter>
<Setter Property="Background" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
</Window.Resources>
<DockPanel LastChildFill="True">
<Label DockPanel.Dock="Top" Name="WinHeader" Height="30" Background="BurlyWood" FontFamily="Calibri" FontSize="20" FontWeight="Bold" FontStretch="Medium" VerticalAlignment="Top" HorizontalAlignment="Stretch" Margin="0,0,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Top">URL Validator</Label>
<Grid DockPanel.Dock="Bottom" Background="Beige">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/> …Run Code Online (Sandbox Code Playgroud) 我有问题试图从我的VS 2012删除记录,我正在使用sql server 2012,这是我的讲师的任务,我无法解决它
现在这就是我的意思
Private Sub bt_hapus_Click(sender As Object, e As EventArgs) Handles bt_hapus.Click
Try
Dim sqlda As New SqlClient.SqlDataAdapter("Delete from tabelpasien where No_Rkm_Mds=" & Me.txt_rkm_mds.Text, Me.SqlConnection1)
sqlda.Fill(dspasien, "tabelpasien")
MsgBox("Data telah berhasil dihapus")
bersih()
pasif()
normal()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Run Code Online (Sandbox Code Playgroud)
任何帮助都会大大贬低......
仅供参考:使用VS 2010和Access 2010创建Windows桌面应用程序
在尝试查询和访问数据库时,我在VB.Net中遇到了一些奇怪的行为.我有一个SQL脚本,当在Access中运行时,会生成一个包含记录的数据集.但是,当我在VB.Net(连接到同一访问数据库)中运行相同的脚本时,查询不会产生任何结果.这是我的.Net脚本:
Dim strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & item.Text
Dim conn As System.Data.OleDb.OleDbConnection
Dim da As OleDbDataAdapter
Dim s As String = " SELECT" & vbCrLf _
& " GrantData.[Grant Number]," & vbCrLf _
& " OutputData.[Output], " & vbCrLf _
& " OutputData.PlanNumber, " & vbCrLf _
& " OutputData.ActualNumber" & vbCrLf _
& " FROM " & vbCrLf _
& " Themes, " & vbCrLf _
& " GrantThemes, " & vbCrLf _
& " GrantData," …Run Code Online (Sandbox Code Playgroud) 如何解决此错误..当用户输入整数并乘以它时,我的代码的这一部分没有问题
但是当用户输入像"1/2,-2/3 ETC"这样的小数(负数或正数)时会出现错误
错误指向:new1 = CDbl(txta1.Text)*CDbl(txtb2.Text)*CDbl(txtc3.Text)
错误消息:从字符串"1/2"到"Double"类型的转换无效.
查看plaincopy到clipboardprint?昏暗的new1,new2,new3,new4,new5,new6,add1,add2,minus1 As Double
new1 = CDbl(txta1.Text) * CDbl(txtb2.Text) * CDbl(txtc3.Text)
new2 = CDbl(txta2.Text) * CDbl(txtb3.Text) * CDbl(txtc1.Text)
new3 = CDbl(txta3.Text) * CDbl(txtb1.Text) * CDbl(txtc2.Text)
new4 = CDbl(txtc1.Text) * CDbl(txtb2.Text) * CDbl(txta3.Text)
new5 = CDbl(txtc2.Text) * CDbl(txtb3.Text) * CDbl(txta1.Text)
new6 = CDbl(txtc3.Text) * CDbl(txtb1.Text) * CDbl(txta2.Text)
Run Code Online (Sandbox Code Playgroud) 我已经创建了一个应用程序,它的一些功能只适用于管理员权限,
如何检查应用程序是否以管理员权限运行?
这在VB.Net中工作
Dim sSQL As String
sSQL = <sql>MySQLQueryHere</sql>.Value
Run Code Online (Sandbox Code Playgroud)
但是,这在C#中不起作用
string sSQL = "";
sSQL = <sql>MySQLQueryHere</sql>.Value;
Run Code Online (Sandbox Code Playgroud)
以下部分显示了构建后的错误。
Run Code Online (Sandbox Code Playgroud)sSQL = <sql>MySQLQueryHere</sql>.Value;
关于我在做什么错的任何建议吗?
我正在为Uni做任务,在我的VB.NET表单中我有一些复选框,我正在尝试循环并清除它们(我有一个按钮,它将清除表单)
我的问题是,当没有明确告诉VB我想要使用哪个复选框时,似乎没有可用于设置复选框状态的属性.例如,我可以去
WineCheckBox.Checked = False
Run Code Online (Sandbox Code Playgroud)
这将检查框,但我的魔杖干扰代码,而不必为我的每个复选框重复这个,这是我试图做的:
If TypeOf element Is CheckBox Then
element.Checked = False
End If
Run Code Online (Sandbox Code Playgroud)
我尝试过使用element.CheckState并且element.Checked两次都得到"Checked(或CheckState)不是System.Windows.Forms.Control的成员"
我已经查看了我能找到的所有属性,但这些属性对我来说似乎都没用...
我错过了什么吗?或者这是不可能的
谢谢
编辑:
这是整个代码块:
'clear the controls
For Each element As Control In Me.Controls
If TypeOf element Is TextBox Then
element.Text = ""
End If
If TypeOf element Is CheckBox Then
element.Checked = False
End If
Next
Run Code Online (Sandbox Code Playgroud) vb.net-2010 ×10
vb.net ×7
.net ×1
admin ×1
c# ×1
c#-to-vb.net ×1
data-binding ×1
ms-access ×1
sql ×1
vb.net-to-c# ×1
wpf ×1