|
Hi there,
A little quistion.
I have a Form that contain's a textfield and a Button.
If the button is pressed a new form opens (the old form stays open too)
The new form contains a datagrid where the user can select a customer.
On the dubble click of the row the form closes and should put this value into the textfield.
the select row is not the problem.
the dubbelclick isn't a problem as wel.
the problem is how can i fill the textbox when dubbelclicked on the row.
I can pass the data between the forms. and usaly i use the initialize component or formload to fill up the forms.
But in this case he doesn't reopen the first form.
|
|
|
|
|
on double click event :
Form1 frm1 = new Form1();<br />
frm1.TextBox1.Text = selectedrow text
|
|
|
|
|
that opens a new form and that is not exactly what i want cause he loads my populate textbox event which is defined by initialzi components.
|
|
|
|
|
Form1 frm1 = new Form1();<br />
frm1.TextBox1.Text = //value
this code doesn't open form as u see it's declared new instance of Form and then via that instance it's refered to text of textbox.
|
|
|
|
|
oke open was maybe a bad word to use..
but if i use this he will go to the initialize components section of the form and i wan't to skip that part i really don't want him to do this..
cause there he loads an event wich contains data from a previous form. any way he doesn;t load this 2 times.
|
|
|
|
|
If i want to bypass this with a if else sting.empty he says that he cannot covert string to bool.
|
|
|
|
|
i used to get the last value (in order to insert new record) like this
(select max(IdColumnName) from TableName) , but it seems its not the best
approach to do this , why??
why (select @@identity) is consider as the good way ??
thank you all
Tamimi - Code
|
|
|
|
|
Getting the largest id is not a safe way to get the id of the record. If another user added a record at the same time, you will get the wrong id. Consider this scenario:
:: User 1 adds a record, which gets id 42.
:: User 2 adds a record, which gets id 43.
:: User 1 gets the highest id, which is 43.
:: User 2 gets the highest id, which is 43.
Now both users think that they added the record with id 43.
Using @@identity on the other hand is completely safe. A user will always get the last id that was created in the database session, e.g. with the same database connection.
---
b { font-weight: normal; }
|
|
|
|
|
you know.. the best way to undersatand this is to try it;)
i will try to check it on a small application
thanks
Tamimi - Code
|
|
|
|
|
Guffa wrote: Using @@identity on the other hand is completely safe
In SQL Server, you never used to be assured to 100% always get the right id with @@identity. So in sql server 2000 they added a built in fuction called SCOPE_IDENTITY() which is AFAIK 100% guaranteed to get you the right ID.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Correct. I mentioned the scope_identity function in the previous thread:
http://www.codeproject.com/script/comments/forums.asp?forumid=1649&mode=all&userid=3050175&select=1532206&df=100&tid=1531522#xx1532206xx
AFAIK there is only a difference between @@identity and scope_identity() when you are using triggers that uses inserts.
@@identity will always return the last id created in the session, but if the trigger also inserts a record you will get the id of that record instead of the id from the insert that caused the trigger to run.
---
b { font-weight: normal; }
|
|
|
|
|
I created a screensaver project, used all the default settings. When the project is completed, it works fine with two images (SSaverBrackground,SSaverBrackground2). I cannot find A way to add more images.
Any help is greatly appreciated
Using VS 2005
|
|
|
|
|
i have a dataset that is filled from a webservice. The dataset will contain a table with 2 columns. What's the code to bind the DysplayMember property to one of the Columns and the Value member to the other one??
rzvme
|
|
|
|
|
u can use
comboBox1.DataSource=Dset.Tables["table name"];
comboBox1.DisplayMember="column1 name";
comboBox1.ValueMember="column2 name";
rahul
|
|
|
|
|
tried that too: error:An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll
Additional information: Could not bind to the new display member.
rzvme
|
|
|
|
|
try to check that u have used same column names which are used in table in database.
rahul
|
|
|
|
|
defenently the same name...let's say i used the northwind database..and the categories table
this is the code:
private void Form1_Load(object sender, System.EventArgs e)
{
myserv.Service serv = new myserv.Service();
dataSet1=serv.GetNames();
dataSet2=serv.GetNames();
comboBox1.DataSource=dataSet1;
comboBox1.ValueMember="CategoryID";
comboBox1.DisplayMember="CategoryName";
}
i just can't avoid this error
rzvme
|
|
|
|
|
How do I connect to MySQL using C#?
What do I need to do so?
plz help me out ...!!!
I have never used MySQL before, all help is greatly appriciated.
phil chris
|
|
|
|
|
create DSN of ur database
System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection("DSN='dsn name'");
conn.Open();
rahul
|
|
|
|
|
They are also a MySqlconnector , search it on the mysql site
bye
|
|
|
|
|
Thanks for the help so far guys.
KnOw yAr Rol3,
phil chris
|
|
|
|
|
hello,
does anybody know how to determine the pixel width of a string if given the font and font size? i would like to be able to do this using c#, but i have no idea where to start.
thanks!!!
RC
|
|
|
|
|
You can probably look here -> [TextRenderer.MeasureText]
It's new to the .NET 2.0 framework according to MSDN website. There are examples in VB and C# about 3/4 of the way down the page.
Hope this gets you off in the right direction.
Mike Poz
|
|
|
|
|
Hello all,
I have just got this new HP Compaq nx6125 laptop which has a finger scanner which helps me to log into the computer. I was just thinking does anyone know how we can program the finger scanner to reconize the finger. In short how to i learn finger scanning programming...
I know its very hard... but if any one has any code or any directly i would really appreciate it a lot..
CH
|
|
|
|
|
I'm not sure where to begin, but I would say that C# probably isn't the right tool for the job. You're most likely going to have to work with device drivers in C, that'd be my suggestion of where to start looking, at least.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Goof around music jam with my brothers (with video)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|