如何从动态创建的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
最满意答案
你可以使用
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 ...
-
使用laravel eloquent关系来检索除NULL之外的所有记录(Using laravel eloquent relation to retrieve all records except NULL)[2022-02-20]
您可以使用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); })-> ...