VB 2008上的格式字符串问题 [英] Format String problem on VB 2008

查看:96
本文介绍了VB 2008上的格式字符串问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个想要格式化的程序,为此,我需要使用格式化字符串.

基本上我是这样的:

Hi, i am running a program that wants to format and in order to do so i need to use format string.

Basically what i have is this:

Dim fmtStr As String = "{0,-5} {1,7} {2,8}"
        ListBox1.Items.Add(txtItems.Text & "          Quantity: " & txtQty.Text & "          $" & Amount)



我想要的是使下面的txt(txtItems,txtQty可以使用格式字符串吗?我该怎么做?



What i want is to make the below txt(txtItems, txtQty to work with the format string? How do i do so?

推荐答案

"&金额)
" & Amount)



我想要的是使下面的txt(txtItems,txtQty可以使用格式字符串吗?我该怎么做?



What i want is to make the below txt(txtItems, txtQty to work with the format string? How do i do so?


可以使用String class的Format static方法用于此目的,如下所示:
The Format static method of String class can be used for this purpose as shown below:
Dim fmtStr As String = String.Format("{0,-5}         Quantity: {1,7}


{2,8}", txtItems.Text,txtQty.Text,Amount)
{2,8}", txtItems.Text,txtQty.Text, Amount)


我认为可以使用{2,8:C}代替


I think {2,8:C} can be used instead of


这篇关于VB 2008上的格式字符串问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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