【发布时间】:2023-03-12 21:50:01
【问题描述】:
我正在尝试从条目中获取 int 值。 .Text 获取字符串,但我不知道如何保存 int 值。 Kullanicilarr.Telefonno 和 Kullanicilarr.GrupID 被限制为获取 long 和 int 值,因为我不能使用 Phone.Text 或 GrupID.Text。有没有像“.Text”这样的参数名称可以用来获取 int 值?
<StackLayout Spacing="20" Padding="15">
<Label Text="Name" FontSize="Medium" />
<Entry Text="Enter Name" FontSize="Small" x:Name="Name" />
<Label Text="Phone" FontSize="Medium" />
<Entry Text="Enter Phone Number" FontSize="Small" x:Name="Phone"/>
<Label Text="Group Id" FontSize="Medium" />
<Entry Text="Enter Group id" FontSize="Small" x:Name="Group"/>
<Button x:Name="btn" Text="Add" Clicked="btn_Clicked"/>
</StackLayout>
async void btn_Clicked(object sender, EventArgs e)
{
Kullanicilarr.Kullaniciadi = Name.Text;
Kullanicilarr.Telefonno = Phone.Text;
Kullanicilarr.GrupID = Group.Text;
await Navigation.PopModalAsync();
}
我希望在那个 Kullanicilar."something" with Group."something" 中保持价值观
【问题讨论】: