小编Ale*_*lex的帖子

VB.NET - 从随机数生成器中删除一个数字

我正在尝试创建一个彩票模拟器.彩票有6个数字,生成的数字必须介于1 - 49之间,并且不能生成下一个数字.我尝试过使用OR功能,但我不确定我是否正确使用它.任何帮助都会很棒.谢谢.

Public Class Form1

Private Sub cmdRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRun.Click
    ''#Creates a new Random class in VB.NET
    Dim RandomClass As New Random()



    ''####################################
    Dim RandomNumber1 As Integer
    RandomNumber1 = RandomClass.Next(1, 49)
    ''#Displays first number generated
    txtFirst.Text = (RandomNumber1)



    ''####################################
    Dim RandomNumber2 As Integer
    RandomNumber2 = RandomClass.Next(1, 49)
    If RandomNumber2 = RandomNumber1 Then
        RandomNumber2 = RandomClass.Next(1, 49)
    End If

    ''#Displays second number generated
    txtSecond.Text = (RandomNumber2)



    ''####################################
    Dim RandomNumber3 As Integer
    RandomNumber3 = …
Run Code Online (Sandbox Code Playgroud)

vb.net random

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

空参考例外

"你调用的对象是空的."

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace XNAdev
{
    class Sprite
    {
        //The size of the Sprite
        public Rectangle Size;

        //Used to size the Sprite up or down from the original image
        public float Scale = 1.0f;

        //The current position of the Sprite
        public Vector2 Position = new Vector2(115, 0);
        //The texture object used when drawing the sprite
        private Texture2D mSpriteTexture;

        //Load the texture for the sprite using the Content Pipeline …
Run Code Online (Sandbox Code Playgroud)

c# xna 2d sprite nullreferenceexception

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

标签 统计

2d ×1

c# ×1

nullreferenceexception ×1

random ×1

sprite ×1

vb.net ×1

xna ×1