|
|
Use the jobs board[^] to post any job posting. Do not spam the programming forums.
|
|
|
|
|
1. I have 2 forms, form1 and form2. form1 has a button click event, and form2 has a method called displayText(string s).
When i click the button on form1 how do i get form2 to invoke the displayText() method?
Does form2 have to be static or is there another way? Also how do i make a static form in VS2005?
2. What would be the best way to implement a console into an application? Some sort of text box and use custom methods to add text? or is there a droppable control and possibly exploit Console.Out methods.
3. What is the best way to implement user authentication where users are stored online (something like windows activation), google returns absolutely nothing when i searched for application authentication. Also any details to prevent cracking etc will be appreciated (this doesnt have to be total crack proof etc, just interested in learning).
-- modified at 23:07 Monday 11th June, 2007
|
|
|
|
|
Better buy a book For COnsole Application ie., Windows Application adn try to learn the concept and implement it.
We cannot explain it here about all the Questions You have Asked?
SO for what you tried for the Console Application and also abouit the Cross Page Post back and also about the User Authentication.
Better buy a book and start reading it and try to implement it.
Regards,
Satips.
|
|
|
|
|
Sorry i dont understand the first 3 lines of your post.
|
|
|
|
|
|
1 - if form1 holds the instance of form2, it can call a method on the form. Either way, a delegate is the nicest way to do this
2 - There's no control apart from the textbox
3 - The best way is to store user roles in a database. The issue is, if it's a windows app, people can just decompile your code and remove your authentication checks.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
1. What if i want to do the reverse, form2 calls a method in form1 when form1 holds the instance.
|
|
|
|
|
Hello,
Like Christian said before, a delegate would be the nicest way.
But you could also pass the instance from form1 to form2 (for example over the constructor).
All the best,
Martin
|
|
|
|
|
Ok thanks, never thought of that.
|
|
|
|
|
|
i don't know what to do really i've seen the code 100 times and it seem right
so if anyone can help....this's the code
public void ajout_dossier_image(string dossier,string matr)
{
if (Directory.Exists(dossier))
{ try
{
scanDirectory(dossier, "*.jpg", System.IO.SearchOption.TopDirectoryOnly);
String selectedImage = selectedImg;
if (imgList == null)
return;
foreach (String img in imgList) {ajout_image_seul(img, matr);}
}
catch (Exception exe) { MessageBox.Show("erreur du dossier de l'image");}
}
}
public void ajout_image_seul(string nom_img,string matr)
{
try
{
string date = "01/01/2005";//Convert.ToString(DateTime.Now)
string conStr = @"Provider=Microsoft.JET.OLEDB.4.0;" + @"data source=DermatoSoft_DB.mdb";
dataGridView1.DataSource = null;
ds = new DataSet();
conn = new OleDbConnection(conStr);
command = conn.CreateCommand();
conn.Open();
command.CommandText = "INSERT INTO Image (Numero_Patients,Nom_Image,Date_Image,"
+"Commentaire_Image) VALUES (" + matr + ",'" + nom_img + "','" + date + "','exemple commentaire')";
adapter = new OleDbDataAdapter(command);
adapter.Fill(ds);
conn.Close();
}
catch (Exception exe)
{
MessageBox.Show("erreur dans l'ajout de l'image");
}
}
thanks
|
|
|
|
|
What's happening when you run it?
If your getting an error what is it?
I think part of the problem is using the adapter.Fill method - I'm pretty sure that you need to use the Update method and also I'm not sure yoy sepcify a command text for the dataset - I thought you used an InsertCommand and calling update called the appropriate Commands with the change rows in the Dataset, and likewise the appropriate Update and Delete commands - been a while though so I could be wrong there - I'll look it up and let you know.....
|
|
|
|
|
my problem is that i used this command in other part and i'm sure that the command run
the error is that he cant make the instruction insert into
that there's an error in type
|
|
|
|
|
Well I was right in the first instance - if you look at the constructor for the OleDbDataAdapter - the command query which you pass in is for the SELECT command ONLY - so it's not going to take care of what you are trying to achieve here - you need to create an InsertCommand and then call update - that should fix it (maybe!)
|
|
|
|
|
i know the problem is that he don't wanna connect to the table image that i added but for the first table patient he can can connect this thing gonna make me crazy
so please can you tell me why csharp can access to an access table and not another and the two are in the same file
so please help
|
|
|
|
|
Thats's not the problem as far as I can see - sorry I'm struggling a bit with your english to understand what you are saying, but I think your issue is that the connection is fine - it's what you are trying to do with it is wrong. You can't use an INSERT (SQL) statement as a SelectCommand on the adapter and you can't use the Fill method on the adapter to call the InsertCommand - you have to use the Update method instead.
Perhaps you can put up the error and maybe that might cast some more light - but it looks as though it's just an issue with using the adapter incorrectly...
|
|
|
|
|
i tryed "select * from image" and they don't work
and i tryed "select * from patients" and they work
and the two table are in the same file named data_base.mdb
thanks anyway
|
|
|
|
|
Hmmm ok that is strange,
One thing that can occue on a SQL database is that case sensitivity can be on which means that a table called Image will not be found if you look for a table called image - no idea if that applies to an access database - but I guess it's worth a try?
|
|
|
|
|
Hi everyone,
I'm running into a problem while trying to format strings for printing. I'm working heavily with finance and I need the values to be flushed right and formatted as cash. Unfortunately none of the values are being formatted correctly. I assumed that if the String.Format() function was used correctly that the string would be returned with all the information needed to line it up correctly. I ran into a similar problem when trying to line up information in combo boxes. What I think is going on is that the width of a space is much smaller then the width of the characters in a font. Does anyone know of a workaround for this? Thanks. - Will
|
|
|
|
|
Sure, the easy way out is to display/print (parts of) the text using a so called
"non-proportional" font; such font has all characters (including the space char)
with the same width. An example is "Courier New".
|
|
|
|
|
Thanks Luc, That did the trick. I was trying to use system before because I thought it was lined up, but courier worked beautifully.
|
|
|
|
|
I made a C# application and i want the Textbox control to just take numbers and no characters. In VC++ this can be easily done by setting a property.
Any idea how to do this in C#?
Thanks
|
|
|
|
|
Handle the keypress event and check input
|
|
|
|
|
this is easy thing.
you can set as
:
this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if ( !( char.IsDigit( e.KeyChar ) ) )
{
e.Handled = true;
}
}
roger wong
msn:wenmianbj@hotmail.com
|
|
|
|