你好我正试图"转换"我的Powershell脚本变成了Windows窗体,因此看起来不错,而不是在命令行上。
我的Powershell脚本:
# Food selector for the week!
#random Stuff mixed for every day.
Enum RandomFood
{#Add Food here:
Pizza
Quesedias
Lasagne
}
Enum Meat
{#Add Food here:
Steak
Beaf
Chicken
Cordonbleu
}
function Food {
Clear-Host
$Foods = [Enum]::GetValues([RandomFood]) | Get-Random -Count 6
$Foods += [Enum]::GetValues([Meat]) | Get-Random -Count 1
$foodsOfWeek = $Foods | Get-Random -Count 7
Write-Host `n "Here is you'r List of Meals for this week :D" `n
foreach ($day in [Enum]::GetValues([DayOfWeek])) {
([string]$day).Substring(0, 3) + ': ' + $foodsOfWeek[[DayOfWeek]::$day]
}
}
问题是我对C#很新,我正在努力解决以下问题:
我有一个简单的文本框(textbox1
)和一个按钮,然后应该生成所有这些(button1
)
这是我在vb中提出的:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FoodSceduleGenerator
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string[] arr1 = {"Pizza", "Quesedias","Lasagne"};
textBox1.Text = arr1;
}
但它没有用,而且我没有得到它......我花了2个小时在谷歌上搜索,但是真的无法进一步。
我试图先输出整个数组,然后继续。
感谢您提供任何帮助/提示继续