按降序排列数字 [英] Sorting numbers in descending order

查看:32
本文介绍了按降序排列数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 20 个文本框.每个都包含一个特定的数字.我希望 textbox1 到 textboxN 的数字按降序排列.如果任何文本框的值为零,那么我想保留该文本框原样.需要 vb.net 中的示例代码.

I have 20 textboxes. each contains a particular number . I want the textbox1 to textboxN to have the numbers in the descending order. If any of the textbox has a zero value then I want to leave that textbox as it is. A sample code in vb.net needed.

推荐答案

  Dim txt As New List(Of TextBox)
    Dim q = From i In txt 
            Where CInt(i.Attributes("value")) > 0 
            Order By CInt(i.Attributes("value")) Descending 
            Select i

想对您的收藏尝试一些简单的 linq 查询吗?

Whana try some simple linq query over your collection?

这篇关于按降序排列数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆