|
Upvote for a Rimworld reference.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Thanks for all the replies, guys.
Eddy Vluggen wrote: The elements you refer to are from WinForms, and that's not a great engine to build games with
Eddy: What do you use instead of WinForms? And which specific element (or whatever it's called) would you use for (for instance) an index card that can be dragged around and dropped somewhere else within a window?
|
|
|
|
|
Unity
It has a learning curve, but not a terrible one.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Member 13588277 wrote: And which specific element (or whatever it's called) would you use for (for instance) an index card that can be dragged around and dropped somewhere else within a window? It's hard to say it, I hate to say it, but probably WinForms. It has got built-in support for drag and drop, and there's an article on CodeProject showing how to use any bitmap in that drag-and-drop operation.
If you are into creating games, I'd strongly suggest to look at Unity. If you're looking for beta-testers, I'm here
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
You're probably thinking of WPF (Windows Presentation Foundation); and not WFC.
I would consider the WPF "Canvas" control as a starting point for an "absolute positioning" project:
How to: Create and Use a Canvas | Microsoft Docs
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Is this WPF thing out of beta yet?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
It paid off my mortgage last year ...
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Yes, so will IoT, AI and blockchain
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
My (enterprise) WPF is using AI to program and control IOT's using TCP over wired and wireless ...
Current web development reminds me of developing client applications in assembler.
Block chain; another type of "ledger"; mostly looking for a problem to solve. The "currency" model became a vehicle for speculation and tax avoidance; mostly of interest to the same sorts.
Most don't understand "block chain"; that's why they get so excited. They think it's all about "getting coin".
Kodak has just released their own "currency"?! Tulip geld.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Gerry Schmitz wrote: The "currency" model became a vehicle for speculation and tax avoidance If that were the case, more companies would be investing in BitCoin
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Sorry, I meant tax "evasion".
Oh, wait ...
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
How to insert this XML file in SQL Server? I have done one but cannot output. The error said "String was not recognized as a valid DateTime"
Here the code that I done:
SqlDataAdapter adpter = new SqlDataAdapter();
DataSet ds = new DataSet();
int appointment_ID = 0;
string nric = null;
string client_Name = null;
DateTime? appointment_Date = null;
DateTime? start_Time = null;
SqlConnection conn = new SqlConnection(@"Data Source=USER1-PC\SQLEXPRESS;Integrated Security=true;Database=ProductDB");
XmlReader xmlFile = XmlReader.Create("G://appointment.xml", new XmlReaderSettings());
ds.ReadXml(xmlFile);
int i = 0;
conn.Open();
for (i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
{
appointment_ID = Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[0]);
appointment_Date = DateTime.Parse(ds.Tables[0].Rows[i].ItemArray[1].ToString());
start_Time = DateTime.Parse(ds.Tables[0].Rows[i].ItemArray[2].ToString());
nric = ds.Tables[0].Rows[i].ItemArray[3].ToString();
client_Name = ds.Tables[0].Rows[i].ItemArray[4].ToString();
SqlCommand command = new SqlCommand("insert into Appointment values(" + appointment_ID + ",'" + appointment_Date + "'," + start_Time + "'," + nric + "'," + client_Name + ")", conn);
adpter.InsertCommand = command;
adpter.InsertCommand.ExecuteNonQuery();
}
conn.Close();
MessageBox.Show("Done .. ");
Here is appointment.xml:
<interface>
<appointment>
<appointment_id> 000000087508
<appointment_date>2018-01-25
<appointment_start_time>13:15:00
<client>
<nric>456987123
<client_name>JAMES
<appointment>
<appointment_id>000000087501
<appointment_date>2018-01-25
<appointment_start_time>14:30:00
<client>
<nric>963258741
<client_name>Bill Tan
<client>
<nric>123456789
<client_name>David Ang
<checksum>2
|
|
|
|
|
Don't do it like that! Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead.
When you concatenate strings, you cause problems because SQL receives commands like:
SELECT * FROM MyTable WHERE StreetAddress = 'Baker's Wood' The quote the user added terminates the string as far as SQL is concerned and you get problems. But it could be worse. If I come along and type this instead: "x';DROP TABLE MyTable;--" Then SQL receives a very different command:
SELECT * FROM MyTable WHERE StreetAddress = 'x';DROP TABLE MyTable; Which SQL sees as three separate commands:
SELECT * FROM MyTable WHERE StreetAddress = 'x'; A perfectly valid SELECT
DROP TABLE MyTable; A perfectly valid "delete the table" command
And everything else is a comment.
So it does: selects any matching rows, deletes the table from the DB, and ignores anything else.
So ALWAYS use parameterized queries! Or be prepared to restore your DB from backup frequently. You do take backups regularly, don't you?
Chances are, when you fix that throughout your application, the problem you have noticed will vanish at the same time.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Just noting that SQL server can process XML directly.
Jieha Lee wrote: The error said "String was not recognized as a valid DateTime"
Print out your SQL - don't guess, actually print it.
Then you can take that SQL and try it directly on the database.
As a guess as to the error, SQL expects a very specific form for a timestamp (not a 'date') and you have not created that form.
|
|
|
|
|
sir can we take the field as nvarchar to store xml?
|
|
|
|
|
Not sure what that means.
Can you store an entire xml document as text in a single column in a database? Then yes.
However the poster is attempting to process and parse the xml and store the parsed result, not xml, in the database.
|
|
|
|
|
Can someone please help a newbie with what I suspect is a simple error?
Program.cs:
using System.IO;
namespace CreateDT
{
static class Program
{
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
static void MyMethod (name1 string, name2 string)
{
}
}
}
Form1.cs:
using System;
namespace CreateDT
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void DoItButton_Click(object sender, EventArgs e)
{
MyMethod(currentfile, TargetFile);
}
Gives error "CS0103 The name 'MyMethod' does not exist in the current context." I've looked at lots of examples which all seem to be done this way. Obviously not, what am I missing?
|
|
|
|
|
The method 'MyMethod' is inside (= a member of) the (static) class 'Program', so you have to use
Program.MyMethod(currentfile, TargetFile);
|
|
|
|
|
Methods (and fields, properties and events) are part of the class definition: So when you add a method to ClassA, it doesn't exist as part of ClassB. So to access a ClassA method from ClassB, you have to specify which class you are referring to; which class the system should look at - either by specifying a class instance:
Button b = new Button();
b.Text = "Click me!"; Or (in the case of static methods like MyMethod) by specifying the class name:
Program.MyMethod(currentfile, TargetFile);
But you shouldn't really be modifying the Program.cs file - instead add a Utilities.cs file, and create a static class in that. To DO that, right click your project name in the Solution Explorer pane, and select "Add"..."Class...". Change the name from "Class1" to "Utilities" and click the "Add" button.
Change the class to static and add your method to that. Then when you write your code, it's a bit more obvious that these are designed as "generic helper" methods:
Utilities.MyMethod(currentfile, TargetFile);
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.
modified 21-Jan-18 15:05pm.
|
|
|
|
|
They are both private methods of class OrdersContyrolAccessibleObject .
|
|
|
|
|
I try private too I have the same problem.
DB
|
|
|
|
|
It is a simple spelling mistake on your class name.
|
|
|
|