首页 \ 问答 \ 如何从动态创建的vba userform文本框输出变量(How to output a variable from dynamically created vba userform textbox)

如何从动态创建的vba userform文本框输出变量(How to output a variable from dynamically created vba userform textbox)

希望我问的是正确的问题。 我有一个userform,初始化时显示X个文本框。 这是一个片段:

Dim MF As Object

Set MF = Me.Controls.Add("Forms.TextBox.1", "BoxNumber_" & i, True)
    With MF
        .Value = ""
    End With

??? msgbox Me.MF.BoxNumber_i.value

一旦用户完成填写userform,它最终会将结果写入SQL。 我的问题是..一旦用户填写变量,我如何输出变量MF.BoxNumber_i.value?


hopefully I am asking the correct question. I have a userform that displays X number of text boxes when initialized. here is a snippet:

Dim MF As Object

Set MF = Me.Controls.Add("Forms.TextBox.1", "BoxNumber_" & i, True)
    With MF
        .Value = ""
    End With

??? msgbox Me.MF.BoxNumber_i.value

Once a user is finished filling out the userform it will eventually write the results to SQL. my question is.. how do I output the variable MF.BoxNumber_i.value once the user fills this out?


原文:https://stackoverflow.com/questions/33880743
更新时间:2023-02-08 11:02

最满意答案

你可以使用where()闭包

User::where(function ($q) use($city) {
    if ($city) {
        $q->where('city', $city);
    }
})->orderBy('created_at')->paginate(10);

你可以使用when()

User::when($city, function ($q) use ($city) {
    return $q->where('city', $city);
})->orderBy('created_at')->paginate(10);

3.这样做:

$users = User::orderBy('created_at');

if ($city) {
    $users = $users->where('city', $city);
}

$users = $users->paginate(10);

1. You could use where() closure:

User::where(function ($q) use($city) {
    if ($city) {
        $q->where('city', $city);
    }
})->orderBy('created_at')->paginate(10);

2. You could use when():

User::when($city, function ($q) use ($city) {
    return $q->where('city', $city);
})->orderBy('created_at')->paginate(10);

3. Do this:

$users = User::orderBy('created_at');

if ($city) {
    $users = $users->where('city', $city);
}

$users = $users->paginate(10);

相关问答

更多
  • 传递给scope方法的对象是Illuminate \ Database \ Eloquent \ Builder类,而具有columns属性的类是Illuminate \ Database \ Query \ Builder 。 第一个类的对象使用第二个类的内部对象,因此如果要访问其公共属性,则需要执行以下操作: public function scopeFunction($query) { $columns = $query->getQuery()->columns; } 请记住,调用范围后可以应用 ...
  • 您不应该将表列列为模型中的属性(即,不要在模型中声明名称,符号和货币。 而不是在构造函数中分配值,使用::create()或->fill() 。 // This will insert to database and return the object with ID $stock = StockEntity::create(array( 'name' => 'Name', 'symbol' => 'Symbol', 'currency' => 'Australian Dollar' )); ...
  • 所以在过去的几个月里我很少想到这个问题后,我今天重新讨论了这个问题,并在laravel.io上发现了一些非常有用的代码,这些代码经历了我发现自己遇到的同样问题。 我建立在MattApril的解决方案之上,提供了一种我能想到的最简单的方法来提供一种在laravel中提供不区分大小写的关系的方法。 要实现这一点,您需要添加一些新类,这些类利用strtolower()函数创建小写密钥,允许在关系中使用的isset()函数查找不同的但是匹配的密钥: ModelCI.php (app \ Models \ Eloqu ...
  • 刚刚将locality_id添加到select中并且工作正常。 实际上雄辩的作品就像你有2个带有相关项目的数组而你想要匹配它们 - 如果其中一个没有外键,那么指向另一个中的主键,则你不能这样做。 Eloquent完全一样。 您必须始终选择关系的两个键(很可能是一个模型上的PK和另一个模型上的FK)。 Just added locality_id to the select and it worked. Actually eloquent works like you have 2 arrays with r ...
  • 解决方案是在模型中设置mutators。 即使列名是蛇形的,我还是不得不使用驼峰案例作为函数名称。 所以SALES_ORDER_NUMBER成了SalesOrderNumber。 这是一个例子: protected function getSalesOrderNumberAttribute($value) { return $this->attributes['SALES_ORDER_NUMBER']; } protected function setSalesOrderNumberAttribute($v ...
  • 您对关系中列的命名约定不正确(向后)。 约定是${related_table}_id 。 要解决此问题,请更改迁移。 但是,如果您不想仅调整迁移,请将Autore模型中的外键列指定为hasMany关系的第二个参数。 public function libri() { return $this->hasMany('App\Libro', 'id_autore') } 并确保为Libro模型做反演。 Your naming convention on the columns in your relat ...
  • 要从配置中读取,您可以这样做: $value = config('app.timezone'); 阅读文档了解更多 并设置$table你可以在模型中执行此操作: protected $table = 'my_flights'; OK, so for anyone else facing the same issue, this is my workaround and I believe it's clean enough: In the login controller, instead of try ...
  • 您可以使用has方法仅检索具有项目的印版。 \App\Models\Plate::with('project')->has('project')->get(); Docs on: http : //laravel.com/docs/5.1/eloquent-relationships#querying-relations You can use the has method to only retrieve plates that have a project. \App\Models\Plate::wi ...
  • 它不会加入。 它是急切的加载,它使用2个查询。 第二个是IN 。 因此,如果您不想使用JOIN等效项,请使用查询生成器。 Vehicle::leftJoin('...')->get(); https://laravel.com/docs/5.2/queries 此外,如果要监视查询,请安装此程序包: https://github.com/barryvdh/laravel-debugbar It doen't join for with. It's eager loading and it uses 2 qu ...
  • 你可以使用where()闭包 : User::where(function ($q) use($city) { if ($city) { $q->where('city', $city); } })->orderBy('created_at')->paginate(10); 你可以使用when() : User::when($city, function ($q) use ($city) { return $q->where('city', $city); })-> ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)