|
hi!
I am in need of assistance for my project
I need a real example for this.
in the treeview there is the directory and the file that go with it
ex: ----C#
----Test.txt
I have no problem for creating the database in Sql Compact edition
for reading it in the treeview saving it and deleting it
if someone can help with this.
Daniel
|
|
|
|
|
Are you trying to show hierarchical data from your database in a treeview? If so, it would help if you explained the structure of your tables.
/ravi
|
|
|
|
|
 in fact I am trying to build a snippet database for my personnel use
All the one I have seen where a bit complicated to work with
I want to create mine. It will more likely help to understand more the logic behind it
and for the other project that I have with treeview
I am Using SqlCe 3.5 and up.
For the database I have done it this way
static public String Dpath = Application.StartupPath + "\\Data\\";
static public String DB_NAME = Dpath + Application.ProductName + ".sdf";
static public String DB_PWD = "";
static public string sql;
static private string _filename;
static public string filename
{
get { return _filename; }
set { _filename = value; }
}
static private string _filecontent;
static public string filecontent
{
get { return _filecontent; }
set { _filecontent = value; }
}
static public string ConnectString()
{
string connectionString = string.Format("DataSource=\"{0}\"; Password=\"{1}\"", DB_NAME, DB_PWD);
return connectionString;
}
static public void CreateDB()
{
SqlCeEngine en = new SqlCeEngine(ConnectString());
en.CreateDatabase();
en.Dispose();
en = null;
}
static public void CreateTable(string TName)
{
SqlCeConnection cn = new SqlCeConnection(ConnectString());
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
SqlCeCommand cmd;
sql = "create table " + TName + "("
+ "ID INT IDENTITY (1,1) PRIMARY KEY not null, "
+ "FileName NVarChar(50), "
+ "FileContent NTEXT)";
cmd = new SqlCeCommand(sql, cn);
cmd.ExecuteNonQuery();
cn.Close();
}
If there is a better way of doing it it will be appreciated
Thank'a Lot
Daniel
|
|
|
|
|
If you want to display a TreeView of a directory and its files then why do you need a Database?
Veni, vidi, abiit domum
|
|
|
|
|
Because I know how to do it wit the directory and file but I want to do it with database and that is giving me a headache but still want to make one
tank's
|
|
|
|
|
|
I have some ASP.NET Project Files(.aspx and .aspx.cs)in text format[textfile] in a folder
i wanted to open all project files in My Visual studio how can i open?
NOTE:Not like following process
Select File-->openwith-->Visual studio
When we craeted a website we can see 2 files[Web and Web.Debug] in project folder[physical location] What are these files?
|
|
|
|
|
Sandhya Bandar wrote: I have some ASP.NET Then I think it would be better if you posted your question in the ASP.NET forum[^].
Veni, vidi, abiit domum
|
|
|
|
|
Dear Sir,
I create a C# project "The file version maintain utility"
but I can't understand that how to create this project .
Sir I want to code It's project.
So please sir send me code about 'The file version maintain utility'..
my gmail - mukeshsahani002@gmail.com
your faithful
Mukesh
|
|
|
|
|
It's generally a good idea to start off projects by working out what your requirements actually are. You can break these requirements down into steps that satisfy the needs of each part. From these steps, you should be ready to start coding.
At the moment, it sounds like all you have is a name for the project. Unfortunately, no one is going to write this code for you - we're volunteers only; we don't get paid to write your code.
Final point - it's not a good idea to include your email address in a forum. It will end up attracting spam.
|
|
|
|
|
|
Hi! I have a XNA Project with a XNA-game contained inside a winform.
My program.cs looks like this:
Form1 form = new Form1();
form.Show();
Game1 game = new Game1(form.getDrawSurface());
form.Game = game;
game.Run();
I have a setter and a getter in the winfom like this:
Game1 game = new Game1();
public Game1 Game
{
get
{
return game;
}
set
{
game = value;
}
}
So now I can send values from my form to my Game1 in XNA but not the other way around.
How can I send values from XNA to the WinForm?
I have used som solutions I have found on the internet so I don't fully understand everything.
|
|
|
|
|
Create custom events in your Game1 class and subscribe to those events from the game instance in your form
|
|
|
|
|
Thanks.
Can you give me an example? Is it like a method?
|
|
|
|
|
Form1 form = new Form1();
form.Show();
Game1 game = new Game1(form.getDrawSurface());
form.Game = game;
game.GameEvent += HandleGameEvent;
game.Run();
private void HandleGameEvent(object sender, EventArgs e)
{
}
public class Game1
{
public event EventHandler GameEvent;
protected vitual void OnGameEvent(EventArgs e)
{
EventHandler eh = GameEvent;
if(eh != null)
eh(this, e);
}
}
Check out Basic Event Creation in C#[^] and Events Made Simple[^]
|
|
|
|
|
Thanks, it starting to be clear but it isn´t all that simple to me...
So, suppose something happends in my XNA-game.
There is a update-method were I check if the enemy is alive and within range of Another object:
if (!(enemy.IsAlive && (player.X <= enemy.X + 100) && (player.Y <= enemy.Y + 50 || player.Y >= enemy.Y + 50)))
isActivated = false;
if (enemy.IsAlive && (player.X <= enemy.X + 100) && (player.Y <= enemy.Y + 50 || player.Y >= enemy.Y + 50)) {
if ((depthChargeX >= enemyX - 50 && depthChargeX <= enemyX + 50) || (depthChargeY >= enemyY - 50 && depthChargeY <= enemyY + 50) && isActivated == true)
{
enemy.IsAlive = false;
hit.Play();
wreck2.IsAlive = true;
wreck2.Update(gameTime);
}
}
If it isn´t in range I want to send a bool or something to my form so I can e.g. enable or disable a button.
Would I then send that bool to the OnGameEvent or must I create a new class like in one in one of the examples. I am a little confused still I must admit.
But I suppose the HandleGameEvent in the form listens to the event raised.
And
game.GameEvent += HandleGameEvent;
Is where you subscribe to the event raised by the game.
I also get: The name 'HandleGameEvent' does not exist in the current context but I suppose something is missing.
|
|
|
|
|
larsp777 wrote: The name 'HandleGameEvent' does not exist in the current context but I suppose something is missing You are missing the event handler itself. Assuming that it just passed across EventArgs, the handler would look like this:
private void HandleGameEvent(object sender, EventArgs e)
{
} larsp777 wrote: If it isn´t in range I want to send a bool or something to my form so I can e.g. enable or disable a button. A simple event args class that looks like this should help:
public class GameRangeEventArgs : EventArgs
{
public GameRangeEventArgs(bool isInRange) : base()
{
IsInRange = isInRange;
}
public bool IsInRange { get; private set; }
} Now, in your Game, you would declare this as:
public event EventHandler<GameRangeEventArgs> GameRangeEvent; To use this from your game code, I would typically have a helper method that looks like this:
private void RaiseGameRangeEvent(bool isInRange)
{
var handler = GameRangeEvent;
if (handler != null)
{
handler(this, new GameRangeEventArgs(isInRange));
}
} Now, in your code you simply call this method and the event is raised if there is an event handler attached to it in the form. So, what would this look like in the form? Well, you will have something like this:
game.GameRangeEvent += HandleGameRangeEvent;
...
private void HandleGameRangeEvent(object sender, GameRangeEventArgs e)
{
}
|
|
|
|
|
|
Alright, I'm gonna drop this here since I need a .Net specific Regex and I don't know how the .Net Regex engine may affect the expression as whole.
I have a string which is formatted as ASDF@123123 .
The string ASD@F@123123 shall not be considered a valid string, while AS\@DF@123123 shall be considered valid.
What I got so far is (?<=[\\]{2,})(@) which allows me to check whether a \ is leading an @ sign.
The problem starts with the evauluation, I simply can't merge it somehow with (^[^[@\\[\\]\"= \\p{C}]*[@\\d]?$) (which shall do the evaluation of the string as whole).
So, how can I merge (?<=[\\]{2,})(@) into (^[^[@\\[\\]\"= \\p{C}]*[@\\d]?$) ?
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|
|
Why not to break it up
1. letter group -> [A-Z]
1.a with optional \@ -> (\\@)*
2. optional(?) @ -> (@)*
3. numeric group -> [0-9]
[A-Z](\\@)*(@)*[0-9]
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Kornfeld Eliyahu Peter wrote: [0-9]
Let's shorten that to [\d]
[A-Z](\\@)*(@)*[0-9]
Has a single problem with it: Special characters (", Whitespace, dots, commas, hyphens, etc.) are not allowed, e.g.
a_b@123 would be invalid.
Furthermore, \@ would be invalid as well, despite that it is in fact a perfectly valid string.
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|
|
Do you have a full specification of the format you want?
I can come up with something - maybe...
The one I offered here based on my understanding of the sample you gave...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
 Here you go:
SD-IDs are case-sensitive and uniquely identify the type and purpose
of the SD-ELEMENT. The same SD-ID MUST NOT exist more than once in a
message.
There are two formats for SD-ID names:
o Names that do not contain an at-sign ("@", ABNF %d64) are reserved
to be assigned by IETF Review as described in BCP26 [RFC5226].
Currently, these are the names defined in Section 7. Names of
this format are only valid if they are first registered with the
IANA. Registered names MUST NOT contain an at-sign ('@', ABNF
%d64), an equal-sign ('=', ABNF %d61), a closing brace (']', ABNF
%d93), a quote-character ('"', ABNF %d34), whitespace, or control
characters (ASCII code 127 and codes 32 or less).
o Anyone can define additional SD-IDs using names in the format
name@<private enterprise="" number="">, e.g., "ourSDID@32473". The
format of the part preceding the at-sign is not specified;
however, these names MUST be printable US-ASCII strings, and MUST
NOT contain an at-sign ('@', ABNF %d64), an equal-sign ('=', ABNF
%d61), a closing brace (']', ABNF %d93), a quote-character ('"',
ABNF %d34), whitespace, or control characters. The part following
the at-sign MUST be a private enterprise number as specified in
Section 7.2.2. Please note that throughout this document the
value of 32473 is used for all private enterprise numbers. This
value has been reserved by IANA to be used as an example number in
documentation. Implementors will need to use their own private
enterprise number for the enterpriseId parameter, and when
creating locally extensible SD-ID names.
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|
|
|
This is for sure not gonna work:
1 - Group # 3 & 4 are particularly useless.
2 - You only allow ~ and ! to come before a single @ (not escaped)
3 - Escape characters for [, ], " and @ are not allowed.
Thank you for your help, anyways.
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|