情况:
在n ++中打开一个文本文件,进行一些修改,按ALT-F4或关闭程序.N ++不会问"你想保存你的更改吗".相反,它退出并且hdd上的文本文件保持不变.
但是当我再次打开N ++时,MODIFIED文件仍在那里.红色选项卡指示未保存的更改,我可以通过ctrl-s保存它.我也可以通过关闭标签来保存它(n ++会问).
我想每次关闭n ++时自动保存文件.除了这个,我所有的其他都是这样做的.我在n ++选项中找不到任何设置.任何的想法?
在VBA中,我可以通过以下两种方式之一创建对象:
'First way
Dim myCol1 As New Collection
'Second way
Dim myCol2 As Collection
Set myCol2 = New Collection
myCol1.Add "AAA" 'Works
myCol2.Add "BBB" 'Works as well
Run Code Online (Sandbox Code Playgroud)
第二种方式是第一种方式的更详细的版本,还是myCol1和myCol2对象之间实际上有区别?
我想在Access2010中实现QR码,我找到了https://github.com/yas78/QRCodeLibVBA。从 Access 引用 XLAM 不起作用,我不想将所有模块直接插入 Access,因为这会使项目变得混乱。因此,我决定使用古老的 VB6 创建一个 OCX 文件,因为这似乎是将所有位封装到一个简单对象中的最简单方法。
最后,我制作了一个OCX,它有几个关键属性:这是DataString要显示的字符串、、、、、ByteModeCharsetName还有方法ErrorCorrectionLevel、事件和ForeRGBBackRGBRefreshClsOnClickOnDblClick
它在 VB6 应用程序 + Excel 工作表 + Excel 表单中工作正常,但在 Access 表单、报告等中表现得很奇怪。
OnClick属性表的“事件”选项卡中不显示)这是我的问题:
ForeRGB选项卡格式(如通常的文本框等)?ControlSource可以直接绑定到记录集而无需使用 VBA 的属性(在“数据”选项卡上)?这样,我希望我也可以在连续表单上使用该控件。事实上,这是最重要的问题。我认为我已经非常接近我的目标了,但我现在陷入了困境。我知道 VB6 已过时,但在阅读了为 ms access 2010 创建自定义控件后,VB6 似乎是一个简单的选择。编写 OCX 有其他选择吗?
编辑:最终工作控制可在此处 https://github.com/Combinatix/QRCodeAX
我在使用声明新对象时遇到问题 CreateObject()
Sub A()
Dim x
'This works
Set x = CreateObject("Scripting.FileSystemObject")
Set x = Nothing
'This throws an error 429 "Active component cannot create object."
Set x = CreateObject("MSXML2.DOMDocument60")
Set x = Nothing
'The only way I can create object is to add the reference using GUID
Dim y As MSXML2.DOMDocument60
Set y = New MSXML2.DOMDocument60
Set y = Nothing
'This works like a charm
End Sub
Run Code Online (Sandbox Code Playgroud)
我不明白为什么"脚本"有效,"MSXML2"没有.
我在Windows 7 64位上使用MS Access 2010 32位.
我只是想知道是否有可能取消变量.
想象一下,这是我在ASP页面中使用的#include文件
Dim MyVar
MyVar = "Hello World"
Response.write(MyVar)
'From now on I can not use Dim MyVar anymore as it throws an error
'I have tried
MyVar = Nothing
Set MyVar = Nothing
'But again, when you do
Dim MyVar
'It throws an error.
Run Code Online (Sandbox Code Playgroud)
原因是我不能每页多次使用相同的#INCLUDE文件.是的,我喜欢使用Option Explicit,因为它可以帮助我保持代码清洁.
*)编辑:我发现它并不像我想的那么清晰.
想象一下这是一个"include.asp"
<%
Dim A
A=1
Response.Cookie("beer")=A
%>
Run Code Online (Sandbox Code Playgroud)
现在的asp页面:
<!--#include file="include.asp"-->
<%
'Now: I do not see whats in include above and I want to use variable A
Dim A
'And I get …Run Code Online (Sandbox Code Playgroud) 如果我从WotClass.h注释掉#define行,我得到了编译错误: WotClass.cpp:7: error: 'BFLM_DEFINE' was not declared in this scope
它不是假设与范围无关吗?或者是订单中的问题?
WotClass.h
#ifndef WOTCLASS_H
#define WOTCLASS_H
#define BFLM_DEFINE 1 // if commented out then compile fails.
class WotClass{
public:
WotClass();
int foo();
private:
};
#endif
Run Code Online (Sandbox Code Playgroud)
WotClass.cpp
#include "WotClass.h"
WotClass::WotClass(){}
int WotClass::foo(){
return BFLM_DEFINE;
}
Run Code Online (Sandbox Code Playgroud)
Test.ino
#define BFLM_DEFINE 1 // This is before including class
#include "WotClass.h"
void setup(){
Serial.begin(115200);
Serial.println(BFLM_DEFINE);
WotClass x;
Serial.print(x.foo());
}
void loop(){}
Run Code Online (Sandbox Code Playgroud) 我为 Arduino Nano 编写了一个代码,我遇到了这种奇怪的行为:
#define GREAT (60 * 60000)
#define STRANGE (60 * 6000)
#define ZERO_X (60 * 1000)
void setup() {
Serial.begin(115200);
Serial.println(GREAT); // Prints 3600000, that's correct
Serial.println(STRANGE); // Prints 32320, thats wrong
long zerox = ZERO_X;
Serial.println(zerox); // Prints -5536, thats also wrong, obviously
}
void loop() {}
Run Code Online (Sandbox Code Playgroud)
到底是怎么回事?
我将 MSVS2019 社区与 vMicro 一起使用
vba ×3
arduino ×2
access-vba ×1
activex ×1
arduino-c++ ×1
asp-classic ×1
c++ ×1
class ×1
ms-access ×1
msxml ×1
notepad++ ×1
qr-code ×1
vb6 ×1
vbscript ×1