小编Che*_*ire的帖子

从列表中填充Combobox

Newb在这里,我正在制作一个有一个组合框的表格,它会显示几个Charlie Brown电视特价,您可以点击选择并查看描述,评级,运行时等.我很接近,但我在填充组合框方面不存在,我希望得到一些帮助和指导.我已经看过别人做过的几件事,但是我知识不足以从我迄今为止看到的内容中推断出答案.

现在我也在尝试:1.从你的加载方法获取列表2.循环它们3.访问我的组合框,用列表中的时间填充该框.

Form1.cs的

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Globalization;//Used for Sting.ToUpperCase...
using System.Threading;

using System.Threading.Tasks;// Needed for Streaming...
using System.IO;// Needed for Streaming...


namespace a100___GUI___VideoStoreSelections
{
public partial class FormMovieLookUp : Form
{
    private const String FILE_NAME = "txt_movieDescriptions.txt";//connect to text file in debug

    private List<Listing> films { get; set; }

    public FormMovieLookUp()
    {
        InitializeComponent();
    }

    private void cmbMovieListingBox_SelectedIndexChanged(object sender, EventArgs e)
    {
        txtTitleBox.Text = cmbMovieListingBox.SelectedItem.ToString();
    } …
Run Code Online (Sandbox Code Playgroud)

c# combobox class list populate

10
推荐指数
2
解决办法
7万
查看次数

PHP语法错误,意外'['发生在主机服务器上,而不是本地服务器......很奇怪?

我有一个奇怪的错误,我没有成功地谷歌搜索结果或找到我可以在stackOverflow上理解的解释.我的代码在我的本地服务器上工作正常,按照我的预期执行,但是当我上传它时,它会返回以下错误'*syntax error,unexpected'['in /home/maxster/max-o-matic.com/_inc/第59行上的functions.php*'.

以下是第59行:

$aaPlaceholderIndex = array_keys($aaPlaceholder)[$row*4+$image]; //if associative array
Run Code Online (Sandbox Code Playgroud)

这是整个功能:

function PrintFolio($aaPlaceholder)

{
//print out X number rows, four items at time

$itemsCount = sizeof($aaPlaceholder);//get size of array
$height = (int)ceil(sizeof($aaPlaceholder)/4);//get size of array divided by 4

//loop through array of X items, for each group of 4 print as a row
for($row = 0; $row < $height; $row++) //looping through the rows

    {
        echo '<div class="row flush">'; //open div
        for($image = 0; $image < 4; $image++)    //each row …
Run Code Online (Sandbox Code Playgroud)

php

2
推荐指数
1
解决办法
437
查看次数

编译时错误 - 无法使用实例引用访问成员

我是一个新尝试理解类和类如何工作的人.我正在构建一个小型控制台程序,我正在处理我的'class.cs'文件,我将其命名为'LineItem.cs',因为它将处理我试图让我的控制台应用程序生成的收据上的订单项.

问题:无法使用实例引用访问成员'A070_ _CashRegister.Program.receipt()'; 用类型名称来限定它.(错误行:#21 /列#13)

当我输入'this.color = price;我认为我在#21行上做过这个.

码:

using System;
namespace a070___Classes___CashRegister
{
  class LineItem     // Class name is singular
                     // receipt might be better name for this class?
  {
    /// Class Attributes
    private String product;     // constructor attribute
    private String description;
    private String color;
    private double price;
    private Boolean isAvailable;

    // constructor called to make object => LineItem
    public LineItem(String product, String description, String color, int price, Boolean isAvailable)
    {
        this.product = product;
        this.description = description;
        this.color …
Run Code Online (Sandbox Code Playgroud)

c# class instance

1
推荐指数
1
解决办法
1万
查看次数

C#Timer在X秒后关闭控制台窗口

newb在这里.

我试图了解如何编写一个计时器来关闭我的c#控制台应用程序,这样我就不必再次点击'return'来关闭窗口(我一直在使用Console.Read();保持它打开所以我可以看到应用程序按目的运行到目前为止)所以我正在尝试制作一个小计时器方法,下面是我发现的远,但它不运行,因为我不明白什么/如何处理它我想.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lec044b_ForLoop_Sum
{
class Program
{
    public void Play()
    {
        Console.WriteLine("Announce Program");






        Console.WriteLine("Close Program Announcement");

        timer1_Tick(3000);


    }


    private void timer1_Tick(object sender, EventArgs e)
    {
        this.Close();
    }



    static void Main(string[] args)
    {
        Program myProgram = new Program();
        myProgram.Play();

    }
}
Run Code Online (Sandbox Code Playgroud)

}

我已经研究了一些,我已经去了微软资源,这些资源是为那些了解这些东西和新手的人写的,并且看了几个博客并且变得越来越困惑.希望得到一些帮助,这是值得赞赏的.

总结一下 - 我只想让我的控制台窗口在5秒后自动关闭.这就是我想用一个简单的方法做的事情.最终我会尝试将其作为一个类或类似的东西,但我需要小步骤,所以我理解.

干杯

c# console timer

1
推荐指数
1
解决办法
1万
查看次数

类错误 - 方法需要对象引用

我目前正在学习C#,我正在努力为下一周的课程做准备,这将是课程和方法的介绍.为此,我尝试构建一个名为MaxBox的类,它是一个通用实用程序类,我可以存储一些常规函数,如"显示字符串"或"再次播放".我已经构建了我的主文件(Program)和我的类文件(MaxBox)以及第23行,第28行和第59行返回相同的一般错误'非静态字段,方法或属性需要对象引用' program.MaxBox.DisplayStr(字符串)".#57返回一个类似的错误'非静态字段,方法或属性'program.MaxBox.PlayAgain()'需要一个对象引用

我真是个新手,而且我正在与物体搏斗,我做了一些研究让自己走得这么远,但我还不懂语言还能够理解我读过的资源是什么说我想解决这个错误.非常感谢帮助和指导.我还在我的第一个星期,我一无所知.

程序:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading; // needed for close
using System.Threading.Tasks;

namespace a020_Breakcase_MeaningOfNames_C
{
class Program
{
    public void Play()
    {
        /*
         * Conditionals - Use switch/Case statement too:
         * Evaluate user data (name)
         * Return meaning of name evaluated
         * OR
         * Return 'Name not found' error message
         * Say goodbye
         */

        MaxBox.DisplayStr("What's in a name? Let's find out!");
        Console.Write("\n\n");

        do
        {
            MaxBox.DisplayStr("Enter Name: ");

            string uName = Console.ReadLine().ToLower();
            switch …
Run Code Online (Sandbox Code Playgroud)

c#

1
推荐指数
1
解决办法
2226
查看次数

C#:方法故障(没有可中断或继续的封闭循环)

新手在这里努力成为一名业余爱好者。

我当前的项目使用方法、类、列表来显示书籍和评论,并允许用户在控制台视图中输入自己的评论。我已经构建了我的类,并且它们此时正在工作,因此我暂时删除了它们,以尽可能清楚地暴露我当前的问题。解决我的问题是,我觉得我的程序很快就变得很大,所以将一些代码移到我称为“选择”的方法中似乎是个好主意。在我将代码移至 select 方法之前,它工作正常/符合预期。但现在我在测试时遇到错误:没有可以打破的封闭循环

具体错误发生在线else if (command == "e"){break;}路上

我尝试将关键字“break”替换为“Continue”,但这不起作用。我已经浏览了网络和 stackoverflow,但没有找到任何我可以理解的内容,以我的理解水平来解决(我仍然是一个新手)。

代码:

    class Program
{
    public void Play(){
        Announcer(" \n\nProgram Name Goes Here \n\n");

        while (true)
        {
            /*
             * Allow user to display director of books (Three)
             * allow user to select specific book with any comments it might have (2-4 comments)
             * Allow user to enter a specific comment
             * display book with new new added comment
             * Allow user to exit book
             * */
            Select();                
        Console.Read(); …
Run Code Online (Sandbox Code Playgroud)

c# methods

1
推荐指数
1
解决办法
2万
查看次数

四舍五入到最近的便士

纽布在这里.

我正在尝试构建一个表单,该表单将接收两个金额,然后根据用户输入的数据返回一组简单的计算(子税的金额,子总金额,总金额,等等

我试图构建一个函数并将其固定在最接近的便士的数量上,但它并没有像希望的那样工作.看起来它似乎是"我认为最接近的100美元大关".我已经google了一下,通过堆栈阅读了一些,我变得越来越困惑,因为我尝试了我认为是一个简单的练习.

指导帮助表示赞赏

我的代码:

<?php //0102e_taxes-01.php

//Constant never changes, 100% available everywhere- almost always simple datatypes (T or F, num, string)
//define('THIS_PAGE', $_SERVER['PHP_SELF']);//shows webroot
 define('THIS_PAGE', basename($_SERVER['PHP_SELF']));//shows app root - gets name of the file basically

 define('TAX_RATE', .095); //current tax rate us => .095 => is 9.5%

//echo THIS_PAGE;// shows this pagefile
//VAR_DUMP - we love it cause we can see everything
function roundNearestHundredUp($number) {
    return ceil( $number / 100 ) * 100;
    }


if (isset($_POST['submit'])) {//if data, do processing …
Run Code Online (Sandbox Code Playgroud)

php forms function rounding

1
推荐指数
1
解决办法
2577
查看次数

在 C# 中使用方法返回值 int

我正在上 c# 编程课,这是我们的第一周,我正在努力工作。为此,我正在尝试重新设计我们的一个课堂实验室,并坚持使用我的“GetInt”方法。

理想情况下,GetInt 方法(第 50 行)接受一个字符串(输入一个数字)并将该数字作为 int 返回,这样我就可以用它来做一些数学运算。当前第 24 行将测试错误“无法隐式转换类型 'int' 转换为 'string'。

任何帮助表示赞赏。我是一个新手,所以请不要以为我什么都知道。谢谢你。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace lec022_If_statement_int
{
class Program
{
    //Set to public so it is visible
    //void because it returns nothing
    //Play is a method within the class Program I've added
    public void Play()
    {
        DisplayStr("Lecture 2c | If Statements with ints");
        DisplayReturns();

        DisplayStr("Welcome to Dunut King");
        DisplayReturns();

        //Collect User Name
        //GetString converts to lower, trims
        String numDonuts …
Run Code Online (Sandbox Code Playgroud)

c# string methods int return

-1
推荐指数
1
解决办法
4081
查看次数

标签 统计

c# ×6

class ×2

methods ×2

php ×2

combobox ×1

console ×1

forms ×1

function ×1

instance ×1

int ×1

list ×1

populate ×1

return ×1

rounding ×1

string ×1

timer ×1