本文介绍了VB.Net:获取剪贴板内容时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该程序的目的是重命名丢失的文件.当我选择一个文件时,按F8键将其重命名.为什么我不使用循环,因为使用循环时会出现相同的错误.

有人可以帮我吗?

**
将strClip设置为String = Clipboard.GetText()''时出现错误."
在子过程中:Rename_AddSameValue.

***
想告诉我,有很多简单的方法可以做到这一点.
:)

The purpose of this program is to rename lost of files. When I select a file , press F8 to rename it. Why I don''t use loop because have same error when I use loop.

Could anyone help me with this?

**
Error on "Dim strClip As String = Clipboard.GetText()''Get current file name."
in Sub procedure : Rename_AddSameValue.

***
Thinks for tell me there''s much simplet ways to do that.
:)

Public Class Form1

    Private Sub tmr_Tick(ByVal sender As System.Object, _
                         ByVal e As System.EventArgs) Handles tmr.Tick

              If (Win32API.GetAsyncKeyState(Keys.F8) < 0) Then
                Rename_AddSameValue("Test_")

                DownArrow()'press DownArrow jump to next file.

               End If
    End Sub

    Sub Rename_AddSameValue(ByVal strToAdd As String)
        F2()' press F2.

        Sleep(10)
        Ctrl_C()' press Ctrl + C.

        Sleep(10)
        Dim strClip As String = Clipboard.GetText()'Get current file name.

        'Create a new file name by conbine "test_" and current file name.
        Sleep(10)
        strToAdd = strToAdd & strClip

        Sleep(10)
        PasteTxt(strToAdd)'Press Ctrl + V to paste new name.

        Sleep(10)
        EnterPress()'press enter 
    End Sub
End Class

推荐答案




这篇关于VB.Net:获取剪贴板内容时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 05:59