c#windows窗体选项卡控件

编程入门 行业动态 更新时间:2024-10-26 03:26:17
本文介绍了c#windows窗体选项卡控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

任何人都可以帮我提供一个代码,用于显示文本框中输入的文本中的元音,文本应该以标签显示.. i使用选项卡控件放置文本框和标签我放置文本框在一个标签中并在另一个标签中标记.. 例如,如果在文本框中输入的文本是David 那么如果我在另一个标签中点击标签标签应该在标签内部显示一个msg:a,i plz帮我解释代码

can any one help me with a code for displaying vowels from a text entered in a textbox and text should be displayed in a lable .. i used tab control for placing textbox and lable i place textbox in one tab and lable in another.. Ex if the text entered in text box is David then if i click lable in another tab a msg should be displayed inside the lable Vowels are : a,i plz help me with the code

推荐答案

使用keypress事件用于更新标签的文本框。 use keypress event for textbox to update the label.

在.cs页面上写下此方法 Write this method on your .cs page public static string ExtractVowels(string text) { // Note that this won't find upper-case vowels... var vowelArray = text.Where(c => "aeiou".Contains(c)) .ToArray(); // Upper-case it if you want, of course. return new string(vowelArray); }

在按钮上调用此方法单击

call this method on Button click

label1.Text=ExtractVowels(textbox1.text);

谢谢&注意 Sham:)

Thanks & Regard Sham :)

Char[] vowels = new char[] { 'a', 'e', 'i', 'o', 'u' }; string str = textBox1.Text; string result = ""; string r = ""; char[] ch = str.ToCharArray(); foreach (char c in ch) { if (vowels.Contains(c)) { result = c.ToString(); r = r + result; } else { //consonant } label2.Text = radioButton2.Text + textBox1.Text + "Length is:" + textBox1.TextLength + "Vowels are : " + r;

更多推荐

c#windows窗体选项卡控件

本文发布于:2023-10-31 01:38:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1544608.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:窗体   控件   选项卡   windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!