有什么方法可以使用Delete键从列表框中删除所选项目?

时间:2020-09-21 16:00:58

标签: excel vba delete-row

我想在按Delete键时从列表框中删除选定的项目。 实际上,在用户窗体中,我有一个列表框,用于显示工作表中的数据,还有一个“删除”命令按钮,用于从工作表中删除整个匹配行,然后进行列表框更新。但是我想使用键盘的物理Delete键做同样的事情。 我在互联网上搜索了很多东西,但找不到任何东西。

1 个答案:

答案 0 :(得分:0)

尝试一下

private var emailEntity: EmailEntity = EmailEntity("", 50F)

init {
    viewModelScope.launch {
        when(subject.value.toString()) {
            context.getString(R.string.home_calibrate_card_headline) -> emailRepository.getCalibratePrice().collect {
                emailEntity = it ?: EmailEntity("Error", 100F)
            }
            else -> emailRepository.getRepairPrice().collect {
                emailEntity = it ?: EmailEntity("Error Zwei", 150F)
            }
        }
    }
}

// Price is 50 and does not change..
val price = MutableLiveData(emailEntity.basePrice)