S.T.A.R.S.
banned
You are a good programmer,but THIS was hard for you???
Wow...and I thought I am weird lol xD
Wow...and I thought I am weird lol xD
You are a good programmer,but THIS was hard for you???
Wow...and I thought I am weird lol xD
private bool Collides(Sprite one, Sprite two)
{
if (one == null || two == null)
{
return false;
}
else if
(
two.X < one.X
&& (two.X + two.Width) > (one.X + one.Width)
&& two.Y < one.Y
&& (two.Y + two.Height) > (one.Y + one.Height)
)
{
return true;
}
else
{
return false;
}
}
What you are trying to do with box collision models is draw a box around your objects (player, targets, bullets), then check if the any of the boxes overlap. If so, it's a hit.
From your code snippet, it looks like you are on the right track. Sprites are basically a box already so you just need to see if they overlapped.
Private Class Form1
Private Sub Label1.formload()
Lable1.text = ProcessorName()
End Sub
End Class
Never used VB.NET but in VB6 there is an event called form_load and there you put the start up code.
What does your ProcessorName sub/function return?
Also, merged with our .net thread
moSearch = New Management.ManagementObjectSearcher("Select *
from Win32_Processor")
moReturn = moSearch.Get
For Each mo In moReturn
sCPManufacturer = mo("Manufacturer").ToString.Trim
sCPName = mo("Name").ToString.Trim
sCPSerialNo = mo("ProcessorID").ToString.Trim
next
Ok, well lets start there. Your code to change the label's text is fine, assuming your ProcessorName function returns a string.
Are you trying to read hardware strings to determine the name of the processor? I think something like this will do it.
Code:moSearch = New Management.ManagementObjectSearcher("Select * from Win32_Processor") moReturn = moSearch.Get For Each mo In moReturn sCPManufacturer = mo("Manufacturer").ToString.Trim sCPName = mo("Name").ToString.Trim sCPSerialNo = mo("ProcessorID").ToString.Trim next
It should work in VB, Unfortunately, I haven't built this myself as I don't have a vm with a dev environment for .net right now. If you have option explicit on make sure the variables are dim'd.
It's possible that there's an addin module missing from the project, I'll see what I can find, or if there's an alternative.
What errors are you getting?
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.Diagnostics;
using System.Threading;
using System.IO;
namespace CDForm
{
public partial class Form1 : Form
{
private string fileName = string.Format(@"{0}\teams.xml", Application.StartupPath);
BindingSource Verzameling = new BindingSource();
CDverzameling Teamset = new CDverzameling();
public Form1()
{
InitializeComponent();
MyInitialize();
backgroundWorker1.RunWorkerAsync();
Teamset.ReadXml(fileName);
this.FormClosing += new FormClosingEventHandler(Form1_FormClosing);
}
void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Verzameling.EndEdit();
Teamset.WriteXml(fileName);
}
private void MyInitialize()
{
Verzameling.DataSource = Teamset.Tables["Teams"];
this.txtTeamName.DataBindings.Add(new Binding("Text", Verzameling, "TeamName"));
this.txtMember.DataBindings.Add(new Binding("Text", Verzameling, "Member"));
//this.txtWeapon.DataBindings.Add(new Binding("Text", Verzameling, "Weapon"));
this.txtSkill.DataBindings.Add(new Binding("Text", Verzameling, "Skill"));
this.pictureBox1.DataBindings.Add(new Binding("ImageLocation", Verzameling, "Weapon"));
//this.cmbChooseWeap.DataBindings.Add(new Binding("SelectedValue", Verzameling, "Weapon"));
this.Teamsbn.BindingSource = Verzameling;
}
private void btnToon_Click(object sender, EventArgs e)
{
Process.Start("Notepad.exe", fileName);
}
private void btnSave_Click(object sender, EventArgs e)
{
Teamset.WriteXml(fileName);
}
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
{
this.Activate();
}
private void btnForm2_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Show();
this.Hide();
}
private void picBut_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Title = "Choose Gun For Correct Class.";
dlg.InitialDirectory = "Guns/";
if (!Directory.Exists(initialDirectory))
{
if (initialDirectory != "Guns/")
{
// MessageBox.Show("Not the Right Directory. Please Use the Guns folder in this project.");
dlg.Dispose();
}
else
{
// Do nothing
}
}
if (dlg.ShowDialog() == DialogResult.OK)
{
this.pictureBox1.Image = new Bitmap(dlg.OpenFile());
}
dlg.Dispose();
}
public string initialDirectory { get; set; }
}
}
I see you binding the image but does your database have the appropriate storage types to handle an image?Hey guys, I'm doing a programming thing for college in C#. I'm nearly done. I have to use Databindings, DataSources etc and it has to be finished tomorrow.
This is annoying me, I have a picturebox where I import a picture. I save the record but it doesnt save the picture to that record. It keeps the picture for every record. Also when I restart the program the picture doesn't appear.
This is my code now:
Code: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.Diagnostics; using System.Threading; using System.IO; namespace CDForm { public partial class Form1 : Form { private string fileName = string.Format(@"{0}\teams.xml", Application.StartupPath); BindingSource Verzameling = new BindingSource(); CDverzameling Teamset = new CDverzameling(); public Form1() { InitializeComponent(); MyInitialize(); backgroundWorker1.RunWorkerAsync(); Teamset.ReadXml(fileName); this.FormClosing += new FormClosingEventHandler(Form1_FormClosing); } void Form1_FormClosing(object sender, FormClosingEventArgs e) { Verzameling.EndEdit(); Teamset.WriteXml(fileName); } private void MyInitialize() { Verzameling.DataSource = Teamset.Tables["Teams"]; this.txtTeamName.DataBindings.Add(new Binding("Text", Verzameling, "TeamName")); this.txtMember.DataBindings.Add(new Binding("Text", Verzameling, "Member")); //this.txtWeapon.DataBindings.Add(new Binding("Text", Verzameling, "Weapon")); this.txtSkill.DataBindings.Add(new Binding("Text", Verzameling, "Skill")); this.pictureBox1.DataBindings.Add(new Binding("ImageLocation", Verzameling, "Weapon")); //this.cmbChooseWeap.DataBindings.Add(new Binding("SelectedValue", Verzameling, "Weapon")); this.Teamsbn.BindingSource = Verzameling; } private void btnToon_Click(object sender, EventArgs e) { Process.Start("Notepad.exe", fileName); } private void btnSave_Click(object sender, EventArgs e) { Teamset.WriteXml(fileName); } private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { this.Activate(); } private void btnForm2_Click(object sender, EventArgs e) { Form2 f2 = new Form2(); f2.Show(); this.Hide(); } private void picBut_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "Choose Gun For Correct Class."; dlg.InitialDirectory = "Guns/"; if (!Directory.Exists(initialDirectory)) { if (initialDirectory != "Guns/") { // MessageBox.Show("Not the Right Directory. Please Use the Guns folder in this project."); dlg.Dispose(); } else { // Do nothing } } if (dlg.ShowDialog() == DialogResult.OK) { this.pictureBox1.Image = new Bitmap(dlg.OpenFile()); } dlg.Dispose(); } public string initialDirectory { get; set; } } }
Basically I just need help to save the image and change for each record. So if anyone can help that would be awesome
Sorry I meant to look at this earlier but forgot. I'll try to get to it when I get home. I can't get on mediafire here.I have no idea:L I am new and know nothing about what this means. The best I have been able to program is this:
Version 1: http://www.mediafire.com/?8dnav7neq6ll72j
Version 2: http://www.mediafire.com/?zcxrd8skdvnfqnv
Its a disk cleanup...I want to expand on it so it shows CPU usage with a performance bar, RAM usage with a performance bar, the CPU Name, Model, and the amount of RAM.
I know nothing about Visual Basic, I started a week ago, and don't know where to start
The version 2 crashes on all x86_32 systems it seems, it crashed on all the school computers (which I guess are 32 bit as they used to have XP on, or only have 4gb ram, and had Ubuntu Originally on it.) and my netbook (which is x86_32), and my other Laptop (that is running Windows 7 x86_32, even though it is a x86_64 processor). It only seems to work on my Toshiba which is 64bit, and on Spirit and Smilemans computers, which I guess are 64bit.:angry: Its really frustrating as Version 1 works on them, Version 2 is the same code, but just a different layout of the design, and a code to fade in and out the forms when the value of focus changes. :gun:
Be interesting to know if you have any ideas, as I have exhausted my limited knowledge
I have no idea:L I am new and know nothing about what this means. The best I have been able to program is this:
Version 1: http://www.mediafire.com/?8dnav7neq6ll72j
Version 2: http://www.mediafire.com/?zcxrd8skdvnfqnv
Its a disk cleanup...I want to expand on it so it shows CPU usage with a performance bar, RAM usage with a performance bar, the CPU Name, Model, and the amount of RAM.
I know nothing about Visual Basic, I started a week ago, and don't know where to start
The version 2 crashes on all x86_32 systems it seems, it crashed on all the school computers (which I guess are 32 bit as they used to have XP on, or only have 4gb ram, and had Ubuntu Originally on it.) and my netbook (which is x86_32), and my other Laptop (that is running Windows 7 x86_32, even though it is a x86_64 processor). It only seems to work on my Toshiba which is 64bit, and on Spirit and Smilemans computers, which I guess are 64bit.:angry: Its really frustrating as Version 1 works on them, Version 2 is the same code, but just a different layout of the design, and a code to fade in and out the forms when the value of focus changes. :gun:
Be interesting to know if you have any ideas, as I have exhausted my limited knowledge
I have no idea:L I am new and know nothing about what this means. The best I have been able to program is this:
Version 1: http://www.mediafire.com/?8dnav7neq6ll72j
Version 2: http://www.mediafire.com/?zcxrd8skdvnfqnv
Its a disk cleanup...I want to expand on it so it shows CPU usage with a performance bar, RAM usage with a performance bar, the CPU Name, Model, and the amount of RAM.
I know nothing about Visual Basic, I started a week ago, and don't know where to start
The version 2 crashes on all x86_32 systems it seems, it crashed on all the school computers (which I guess are 32 bit as they used to have XP on, or only have 4gb ram, and had Ubuntu Originally on it.) and my netbook (which is x86_32), and my other Laptop (that is running Windows 7 x86_32, even though it is a x86_64 processor). It only seems to work on my Toshiba which is 64bit, and on Spirit and Smilemans computers, which I guess are 64bit.:angry: Its really frustrating as Version 1 works on them, Version 2 is the same code, but just a different layout of the design, and a code to fade in and out the forms when the value of focus changes. :gun:
Be interesting to know if you have any ideas, as I have exhausted my limited knowledge