|
thanks charith,
i will try with the .net framework
thanks to your reply again
fady
|
|
|
|
|
charith@ramedian.com wrote:
Sometimes it might work without the framework..
Nothing .NET works without the framework....ever (I cant see how you could say "sometimes it might work" )
|
|
|
|
|
Thanks
|
|
|
|
|
I have written a webservice using ASP. There is a class named ReferenceDetails. I can add the webservice to my client side
and create a object of type ReferenceDetails.No problem!
private int _intRefID;
private int _intPatientID;
private int _intDoctorID;
private DateTime _beginDateTime;// = new DateTime();
public ReferenceDetails()
{
this._beginDateTime = new DateTime();
}
I have written another class at the backend containing ReferenceDetails object;
private ReferenceDetails _refDetails = new ReferenceDetails();
public RemindDetailsWrapper()
{
}
The problem is when i am creating a RemindDetailsWrapper() object at the client side it doesn't contain ReferenceDetails object.
Thanks :
|
|
|
|
|
Salam,
I have a rectangle(whose width, height etc is in millimeters) and a string. I want to know how much(no. of characters) of the string can be drawn in that rectangle keeping in view word breaks, line spacing etc. I have used MeasureString but the characters given by it are greater than actual that can be drawn in that rectangle.
|
|
|
|
|
How have you used MeasureString? It does not return a number of characters but the size needed to draw the string.
Have you specified the same font and size for MeasureString as you use when you draw the text?
---
b { font-weight: normal; }
|
|
|
|
|
Hi
If I have a class Person eg:
Class Person
{
private int identity;
public int Identity
{
get
return this.identity;
set
this.identity = value;
}
How can I get the value of identity (for example) using Reflection if I use the following type of code.
Person person = new Person();
this.DoSomething(person);
public void DoSomething(object obj)
{
//int identity = ???????;
Console.Writeline("Identity = " + identity);
}
}
I tried using the Type.PropertyInfo and GetValue, but the help documentation is not that clear and I did not manage.
Can anybody help me with an example perhaps.
Thanks.
Kobus
|
|
|
|
|
public static int GetIdentity(Person person){
Type type = person.GetType()
BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Instance
FieldInfo field = type.GetField("identity", flags)
Object value = field.GetValue(person)
return (int)value
}
I'm a wreck at C#, but i hope this helps!
|
|
|
|
|
For anyone working their way through the Que Certification for exam 316 there is an error in exercise 2.18. For the code to work correctly you will need to add a using System.IO directive otherwise you will not be able to compile the code.
Most people are willing to pay more to be amused than to be educated--Robert C. Savage, Life Lessons
Toasty0.com
Ladder League (beta)
My Grandkids
|
|
|
|
|
How do I develop my C# project into a stand alone software that can run on any computer?
|
|
|
|
|
fire up vs and select new visual c# project then choose the "Windows Application" Template. That will create your stand alone software.
|
|
|
|
|
But I face problems when i try to run the application in computers that do not have visual studio .net.
|
|
|
|
|
.Net apps need the .Net framework to run.
Maybe those computers don't have that framework.
If that is the case, you can download it here[^].
|
|
|
|
|
Is it possible to run a visual C# windows application project on a computer that does not have visual studio?
|
|
|
|
|
|
Yes, of course. It's NOT possible to run it on a machine that doesn't run the .NET framework, as has been pointed out.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Could use someone to double check my work here, looking for unnecessary info, unneeded commands, broken or missing thoughts...meaning did i start somthing but forgot to finish it. and any security violations or leaks that may exist.
I've gotten so far into this that my flow charts are now circles and i've re-written it twice(flowchart). I'm looking for someone or many someones' who would be willing to check it out....
Please note that my desired result is a software program that does not load on any computer that is not allowed for it to load on.
I am attempting to do this by contacting the database and looking for a keyword....if the keyword is missing then it doesn't install.
the keyword is deleted by the software program upon install (yes i understand that i'll have to re apply the keyword upon every new install, i want that!)
then i want every login from the software to log a transaction, as well identify itself on a user id table upon the intial installation.
info about my code:
fp.Value makes a machine id number that is unique for each pc.
InitializeComponent2 is a form that tells the user they've screwed up and closes the app
Connection is the method that loads my treeView from the database
Yes the typeset small, but i didn't want to take up more space than needed.
it should copy over ok.
thanks!!!
<small> DateTime dt = DateTime.Now;
string usename = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
string sqlSelect = "SELECT password FROM user_id WHERE username = 'dash' ";
private void dbConnect()
{
dataConnection.ConnectionString = "user ID=blah;Pwd=blah;Initial Catalog=blah;Data Source=blah";
dataConnection.Open();
dataCommand.Connection = dataConnection;
}
private void InitialTransAxs()
{
this.Cursor = Cursors.WaitCursor;
Fingerprint fp = new Fingerprint();
string MacID = fp.Value().ToString();
try
{
string shostname;
string result;
result = System.Environment.MachineName;
shostname = Dns.GetHostName().ToString();
dataCommand.CommandText = "insert into user_id (username, password, computer_name, dns_name) values ('" + usename + "', '" + MacID + "', '"+ result +"', '" + shostname + "')";
dataCommand.ExecuteNonQuery();
dataCommand.CommandText = "update user_id set password = null where username = 'dash'";
dataCommand.ExecuteNonQuery();
this.Cursor = Cursors.Default;
}
catch (Exception e)
{
MessageBox.Show("(001) Sorry Could not connect to the database, please try again later." +e.Message + e.StackTrace);
}
finally
{
}
}
private void LogTransAxs()
{
this.Cursor = Cursors.WaitCursor;
Fingerprint fp = new Fingerprint();
string MacID = fp.Value().ToString();
string shostname;
string result;
try
{
result = System.Environment.MachineName;
shostname = Dns.GetHostName().ToString();
dataCommand.CommandText = "insert into TransAxs (username, password, computer_name, dns_name, date) values ('" + usename + "', '" + MacID + "', '"+ result +"', '" + shostname + "','"+ dt +"')";
dataCommand.ExecuteNonQuery();
}
catch (Exception es)
{
MessageBox.Show("(002) Sorry Could not connect to the database, please try again later." +es.Message +es.StackTrace);
}
}
private void LoadAccess()
{
this.Cursor = Cursors.WaitCursor;
Fingerprint fp = new Fingerprint();
dbConnect();
dataCommand.CommandText = sqlSelect;
try
{
bool loginOk = false;
bool IdOK = false;
object o = dataCommand.ExecuteScalar();
string thePwd = o as string;
if( thePwd != null)
{
if( thePwd.Equals("board"))
{
loginOk = true;
}
}
if(loginOk == true)
{
InitialTransAxs();
LogTransAxs();
InitializeComponent();
Connection();
dataConnection.Close();
dataConnection.Dispose();
}
else if (loginOk == false)
{
dataCommand.CommandText = "SELECT password FROM user_id WHERE password = '"+ fp.Value() +"' ";
object p = dataCommand.ExecuteScalar();
if (p != null)
{
if (p.Equals(fp.Value().ToString()))
{
IdOK = true;
}
}
if (IdOK == true)
{
LogTransAxs();
InitializeComponent();
Connection();
}
else
{
InitializeComponent2();
dataConnection.Close();
dataConnection.Dispose();
}
}
else
{
InitializeComponent2();
dataConnection.Close();
dataConnection.Dispose();
}
}
catch (Exception e)
{
MessageBox.Show("(003) Sorry you are not authorized to view this material." +e.Message +e.StackTrace);
}
finally
{
dataConnection.Close();
dataConnection.Dispose();
}
this.Cursor = Cursors.Default;
</small>
Dim Beautiful As String
Beautiful = "ignorant"
Label1.Text = "The world is full of " & Beautiful & " people."
Why is common sense such an un-common comodity?
|
|
|
|
|
Hi
i work in a project about database and use datagrid . i want to prevent user from adding new record ( by clicking the * sign in datagrid ) but i can not find anything like allowAdd or CanAdd for disabling the add ability .
can someone help me ?
Regards Amir Jalaly
|
|
|
|
|
The DataGrid class does not have a property that controls whether a new row can be added. But the DataView class does have such a property (along with some others such as AllowEdit and AllowDelete). Here is code that will turn off the append row by getting at the dataview associated with the datagrid.
string connString = @"Provider=Microsoft.JET.OLEDB.4.0;data source=C:\northwind.mdb";
string sqlString = "SELECT * FROM customers";
// Connection object
OleDbConnection connection = new OleDbConnection(connString);
// Create data adapter object
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(sqlString, connection);
// Create a dataset object and fill with data using data adapter's Fill method
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet, "customers");
// Attach dataset's DefaultView to the datagrid control
dataGrid1.DataSource = dataSet.Tables["customers"];
//no adding of new rows thru dataview...
CurrencyManager cm = (CurrencyManager)this.BindingContext[dataGrid1.DataSource, dataGrid1.DataMember];
((DataView)cm.List).AllowNew = false;
If your datagrid contains links, then adding Navigate handler such as the one below to disallow the AddNew.
private void DataGrid1_Navigate(object sender, System.Windows.Forms.NavigateEventArgs ne)
{
if(ne.Forward)
{
CurrencyManager cm = (CurrencyManager)BindingContext[DataGrid1.DataSource,DataGrid1.DataMember];
DataView dv = (DataView) cm.List;
dv.AllowNew = false;
}
}
Live Life King Size
Alomgir Miah
|
|
|
|
|
In the article “Bending the .NET PropertyGrid to Your Will” , “Fruit enum” is define at design time and therefore the selection for property in to the PropertyGrid allow to select one of them. Is it possible to get the values form database on the fly and and allow user to select one of them.
Best Regards,
Hardew Singh
|
|
|
|
|
I suppose you could, but I don't really know how. I haven't used property grids yet.
I'll suggest you post this question in the article's own message board. You'll probably get better answers (including from the author, who knows a lot about his article (I suppose )).
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
It's been awhile since I've been deep into the property grids but yes you can do what you want to do. For valid values (which is what you talk about) there is a GetProperties() method or something like that that you override. You return the list of valid values in that call which can be from a database. Look at this article to get specifics.
MSDN Article on property grids[^]
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
Yes it is Resize but is happen also if i resize manually the form, but i need to understand if the user has clicked on the maximize button.
How?
|
|
|
|
|
I am not sure if such an event is available but in the SizeChange event you
can check for
if ( this.WindowState == FormWindowState.Maximized )
{
...
}
Live Life King Size
Alomgir Miah
|
|
|
|
|