小编Tim*_*ams的帖子

Windows演示文稿表单应用程序中的启动代码

我正在开发一个程序,需要在程序启动时加载文件.我有单独的代码来加载文件,但我一直在使用一些基本方法来尝试找出一种在Windows Presentation Form Application启动时运行代码的方法.目前,我只是尝试在启动此应用程序时运行MsgBox函数.但我无法弄清楚如何做到这一点.

vb.net wpf

3
推荐指数
1
解决办法
6815
查看次数

用文本文件填充两个一维数组

对于我的 Visual Basic 期末考试,我的程序需要将文本文件中的数据读取到两个不同的数组中,每个数组都是一维的。以下是我这样做的代码:

Option Explicit On
Option Infer Off
Option Strict On

Public Class frmMain

    'Constant for filename and a dirty flag variable
    Const INVENTORY_FILENAME As String = "inventory.txt"
    Dim noFile As Boolean = False

    Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'Populates DVD listbox with text file data upon load

        'Variable for reading the file
        Dim myFile As IO.StreamReader

        'Declaring arrays for DVD names and prices
        Dim arrayDVD() As String
        Dim arrayPrice() As Double

        'Variables …
Run Code Online (Sandbox Code Playgroud)

vb.net arrays streamreader

3
推荐指数
1
解决办法
53
查看次数

Visual Basic复制目录

当我尝试将目录复制到另一个目录时,它只复制了我使用此代码段的目录文件

My.Computer.Filesystem.CopyDirectory(Path, Backup, True)
Run Code Online (Sandbox Code Playgroud)

.net vb.net

2
推荐指数
1
解决办法
2809
查看次数

如何在excel中粘贴B列的最后一行?

我需要将H2:L2中的细胞一直向下切割并粘贴到B列的最后一行.

每次数据都不同,所以我不能硬编码任何范围.

VBA代码很不错,从H2:L2向下切割并粘贴/插入B列的最后一行.

到目前为止我得到了.

Range("H2:L2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Cut
Run Code Online (Sandbox Code Playgroud)

excel vba excel-vba

2
推荐指数
1
解决办法
4万
查看次数

每次离开并重新进入类时,Visual Basic都会将我的变量重置为0

我有一张表格可以从用户那里获得财务信息,包括贷款金额,费率和期限.我应该打电话给一个班级来完成这项工作,然后将答案返回给表格.但是,出于某种原因,每当我的程序移出类,返回表单,然后返回类,我将类重置为0的变量.我的代码如下.任何帮助都是极好的.

这是我的表格中的代码:

    'Preform calculation when button is clicked
Private Sub buttonCalc_Click(sender As Object, e As EventArgs) Handles buttonCalc.Click
    Dim loanAmount As New finClass
    Dim rate As New finClass
    Dim term As New finClass
    Dim payment As New finClass
    loanAmount.getLoanAmount = textBoxMortgageAmount.Text
    rate.getAnnualRate = comboBoxAnnualRate.Text.Replace("%", "")
    term.getTermInYears = comboBoxTerm.SelectedItem
    textBoxMonthlyPayment.Text = payment.setMonthlyPayment

End Sub
Run Code Online (Sandbox Code Playgroud)

这个代码来自关联类:

Public Class finClass

Private loanAmt As Decimal
Private termValue As Decimal
Private rateValue As Decimal
Public paymentValue As Decimal

Public WriteOnly Property getLoanAmount
    Set(value)
        If IsNumeric(value) …
Run Code Online (Sandbox Code Playgroud)

vb.net visual-studio-2012

2
推荐指数
1
解决办法
156
查看次数

Vb 6.0项目加载错误

我最近从bitbucket下载了vb6.o项目文件,但无法运行项目,无法在日志文件'0'中生成以下错误,无法加载第0行:无法加载文件E:\ cas \ Forms \ errorform.frm。

vb6 visual-studio

2
推荐指数
2
解决办法
2787
查看次数

Excel中的INDEX MATCH公式

我最近接过了离开公司的人的电子表格.T列中的公式:

=INDEX(BFTable, MATCH(1, (UPPER(LEFT(ST, 2))=$E$1:$E$315)*
      (ProcessingDate>=$A$1:$A$315)*(ProcessingDate<=$B$1:$B$315)*
      (EffectiveDate>=$C$1:$C$315)*(EffectiveDate<=$D$1:$D$315)*
      ($AI3=$P$1:$P$315)*($F$1:$F$315="HM"),0),COLUMN()-COLUMN($T$2)+1)
Run Code Online (Sandbox Code Playgroud)

有人可以向我解释这个公式试图做什么吗?什么是ST?输出与A列中的处理日期相同.虽然选项卡名称是BF,但没有BFTable.

谢谢,

SC

excel excel-formula

2
推荐指数
1
解决办法
335
查看次数

在 IE Web 对话框窗口中自动化 HTML 文档?

发布这个问题我可以为像我这样需要解决这个问题的人提供一个完整的例子......

有时,在自动化 IE 时,您可能会遇到需要与之交互的弹出对话框:我在这里特别讨论 IE 特定的模式对话框,并使用showModalDialog

https://msdn.microsoft.com/en-us/library/ms536759(v=vs.85).aspx

These dialogs are different from the typical "pop-over" dialogs or ones based on window.open() - although they contain HTML, there's no easy way to get a reference to the document contained within the dialog. For example iterating through the windows under the Windows shell does not find this type of dialog.

I figured there must be some way to solve this problem using the Windows API, and I found a bunch of …

internet-explorer automation vba

2
推荐指数
1
解决办法
1226
查看次数

将 JSON 文件导入 MS Access 表

我正在尝试将 JSON 文件导入到 MS Access 表中。我在网上查了一下,发现这个堆栈溢出链接说明了这一点。自动解析 JSON feed 到 MS Access 我已复制并粘贴此字符串中的代码,并修改它以提取我的 JSON 文件,并且该代码似乎确实解析了该文件。但是,我在将解析文件的所有元素放入 Access 表时遇到问题。它似乎只引入不属于对象或数组的元素。换句话说,NPI 元素没有包含在方括号或大括号中,因此导入成功。请参阅下面的代码和 JSON 数据结构。

Private Function JSONImport()
Dim db As Database, qdef As QueryDef
Dim FileNum As Integer
Dim DataLine As String, jsonStr As String, strSQL As String
Dim P As Object, element As Variant

Set db = CurrentDb

' READ FROM EXTERNAL FILE
FileNum = FreeFile()
'Open "P:\PROF REIMB\PROF REIMB\HIX\CY 2021 Analysis\Centene\JSON\provider_facility - jun 52020.json" 
For Input As #FileNum
' PARSE FILE STRING …
Run Code Online (Sandbox Code Playgroud)

ms-access vba json

2
推荐指数
1
解决办法
2万
查看次数

关于重新排列列的宏如何工作的说明 Excel VBA

我从其他地方找到了这段代码,并对其进行了一些修改以满足我的需求,但我不完全确定它是如何工作的。我想知道它是如何工作的,因为我想进一步修改它,但我对 VBA 比较陌生,不明白 Resize、Index 和 Evaluate 函数如何在这个宏中协同工作。

Sub RearrangeColumns()
    Dim newColumnOrder As Variant
    newColumnOrder = Array(1, 2, 3, 4, 41, 42, 43, 44, 5, 6, 49, _
           7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, _
           21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, _
           35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 50, 51, 52)
    Range("A1").Resize(Cells.Find("*", , xlFormulas, , xlRows, xlPrevious).Row, UBound(newColumnOrder) + 1) = …
Run Code Online (Sandbox Code Playgroud)

excel vba

1
推荐指数
1
解决办法
1439
查看次数

使用 Excel VBA 解析 XML

我正在尝试使用 Excel VBA 解析来自 Sharepoint REST API 的 XML 响应。这是 XML 代码的摘录。出于保密原因我更改了一些值

<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="https://company/sites/subsite/_api/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
    <id>4db71c92-9576-4c59-bb85-89d27459139e
    </id>
    <title />
    <updated>2022-04-13T20:17:19Z
    </updated>
    <entry>
        <id>https://company.sharepoint.com/sites/subsite/_api/Web/Lists(guid'e32e86fd-3161-4e44-a654-2424b357d566')/Items(1590)/RoleAssignments/GetByPrincipalId(3)
        </id>
        <category term="SP.RoleAssignment" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
        <link rel="edit" href="Web/Lists(guid'e32e86fd-3161-4e44-a654-2424b357d566')/Items(1590)/RoleAssignments/GetByPrincipalId(3)" />
        <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Member" type="application/atom+xml;type=entry" title="Member" href="Web/Lists(guid'e32e86fd-3161-4e44-a654-2424b357d566')/Items(1590)/RoleAssignments/GetByPrincipalId(3)/Member">
            <m:inline>
                <entry>
                    <id>https://lionbridge.sharepoint.com/sites/LIOXSalesOpsFinancialsDEV/_api/Web/Lists(guid'e32e86fd-3161-4e44-a654-2424b357d566')/Items(1590)/RoleAssignments/GetByPrincipalId(3)/Member
                    </id>
                    <category term="SP.Group" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
                    <link rel="edit" href="Web/Lists(guid'e32e86fd-3161-4e44-a654-2424b357d566')/Items(1590)/RoleAssignments/GetByPrincipalId(3)/Member" />
                    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Owner" type="application/atom+xml;type=entry" title="Owner" href="Web/Lists(guid'e32e86fd-3161-4e44-a654-2424b357d566')/Items(1590)/RoleAssignments/GetByPrincipalId(3)/Member/Owner" />
                    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Users" type="application/atom+xml;type=feed" title="Users" href="Web/Lists(guid'e32e86fd-3161-4e44-a654-2424b357d566')/Items(1590)/RoleAssignments/GetByPrincipalId(3)/Member/Users" />
                    <title />
                    <updated>2022-04-13T20:17:19Z
                    </updated>
                    <author>
                        <name />
                    </author>
                    <content type="application/xml">
                        <m:properties>
                            <d:Id …
Run Code Online (Sandbox Code Playgroud)

xml excel vba xml-parsing

0
推荐指数
1
解决办法
1377
查看次数

使用函数计算 if 语句时,赋值左侧的函数调用必须返回 Variant 或 Object

我在以下代码中收到此错误:

Dim posOfProdInArray As Integer
If isStringInFirstColumnOfMultidimensionalArray(firstCellOfRowTBRead.Offset(0, 2).Value, aggregatedProdsAndTheirData, posOfProdInArray) Then
    sumOfActualDay = sumOfActualDay + firstCellOfRowTBRead.Offset(0, 4).Value * aggregatedProdsAndTheirData(posOfProdInArray, 2)
End If
Run Code Online (Sandbox Code Playgroud)

它在调用 isStringInFirstColumnOfMultiDimensionArray 函数时发生。

这是函数:

Public Function isStringInFirstColumnOfMultidimensionalArray( _
      stringToBeFound As String, arr As Variant, _
      Optional ByRef varToReceivePositionOfString As Integer) As Boolean
Dim i
For i = LBound(arr) To UBound(arr)
    If arr(i, 1) = stringToBeFound Then
        isStringInArray = True
        If IsMissing(varToReceivePositionOfString) Then
        Else
            varToReceivePositionOfString = i
        Exit Function
    End If
Next i
isStringInArray = False
End Function
Run Code Online (Sandbox Code Playgroud)

excel vba

0
推荐指数
1
解决办法
69
查看次数