|
Thankyou very much
it's working good
Know is Drop, Unknown is Ocean
|
|
|
|
|
I wonder if Filesystemwatcher class can handle deletion of more than 3 file objectcs at once (e.g. multiple selection in windows explorer)
|
|
|
|
|
Why don't you try it yourself?
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
So did I I've tried msdn sample-based code and have been loosing updates when creating or deleting more than two files at once
Internalbuffersize property had been set to 32 or 64K
handling code was reduced to incremental(nadd++, ndel++) operatation never the less the variable value was not equal to number of files processed.
|
|
|
|
|
when i run my windows application project using visual studio, everything looks fine. However when i execute the file in my release folder, everything thing looks like in the classic theme instead of the Window XP theme
Can anyone help?
|
|
|
|
|
nevermind, found the cause of the problem
|
|
|
|
|
i just want to make a web application that make mobile skin
like ((www.ownskin.com))
and iwant any one to help me o how can i make it or if there are any i can get help?
|
|
|
|
|
hi.. why when i drag out a listview in vs 2005.
i cant get teh function of listview.selectedindex ?
only selecteditem ..
i want to get the id of the data selected ..
|
|
|
|
|
You have SelectedItems and SelectedIndices - check the Count property of either one of these to make sure there is at least one item selected and if you're just wanting the first item selected then something like this:
int firstSelectedIndex1 = listView1.SelectedItems[0].Index;
int firstSelectedIndex2 = listView1.SelectedIndices[0];
Dave
|
|
|
|
|
hi.. sorry.. i think i would like to use up the DataGridView called dvCustomer
under
private void dvCustomer_SelectionChanged(object sender, EventArgs e)
{
}
when i click on the datagridview row... i would like to get the user ID from database. so that i can do the update as below ..
private void cust_update_Click(object sender, EventArgs e)
{
bool success;
success = dataAccess.AddCustomer(<big>Datagridview ID</big>, cust_name.Text, cust_add.Text, cust_account.Text, cust_phone.Text...);
if (success)
{
MessageBox.Show("Data updated!");
}
else
{
MessageBox.Show("Update FAIL!!!");
}
}
in my dataAccess class
public bool AddCustomer(string function, string custName, string custAdd, string custAcc, string custPhone.....)
{
bool success = false;
string query = string.Empty;
try
{
SqlCommand cmd = new SqlCommand();
cmd.Parameters.Add(new SqlParameter("@companyName", custName));
cmd.Parameters.Add(new SqlParameter("@customerAdd", custAdd));
cmd.Parameters.Add(new SqlParameter("@attName", custAdd));
cmd.Parameters.Add(new SqlParameter("@customerAcc", custAcc));
cmd.Parameters.Add(new SqlParameter("@customerPhone", custPhone));
query += "UPDATE CUSTOMER set company_name= @companyName, company_add= @customerAdd, att_name= @attName, account_num= @customerAcc, phone= @customerPhone...........";
query += " where cust_id = <big>??????????</big> ";
cmd.CommandText = query;
if (cn.State == ConnectionState.Closed) cn.Open();
cmd.Connection = cn;
if (cmd.ExecuteNonQuery() > 0)
{
success = true;
return success;
}
|
|
|
|
|
may i know how do i get the ID from the datagridview ?
|
|
|
|
|
You may be better off reposting in a new thread as this is no longer about the listView as suggested by the subject!
I never use the DataGridView myself so can't be of much help.
Dave
|
|
|
|
|
hi,
i can some english. i hope you understand my question.
i was write a windows service with using a timer. my code such as following.
i was install my builded service with installUtil.exe... my windows service running but i can't see messageBox per 5 second.
you can help me.
Best regards.
Tayfun UZUN
Istanbul/Turkey
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Text;
using System.Windows.Forms;
namespace denemeWindowsService
{
public partial class denemeServis : ServiceBase
{
public denemeServis()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
timer1.Enabled = true;
timer1.Interval = 5000;
}
protected override void OnStop()
{
}
private void timer1_Tick(object sender, EventArgs e)
{
MessageBox.Show("time - " + DateTime.Now.ToShortTimeString());
}
}
}
modified on Saturday, May 24, 2008 8:37 AM
|
|
|
|
|
Services run on different desktop so you won't see a messagebox. You can allow interaction with service but it is not recommended and it isn't supported in Vista.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
I just wanted to know which one I should use. I have looked at the MSDN articles and have only found rigorous descriptions of each one but none of them give comparisons to the others.
p.s. this is my first post, if I have done anything wrong please feel free to tell me.
the code I have is:
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
GC.Collect();
Environment.Exit(0);
}
|
|
|
|
|
|
|
|
I am experimenting mock objects. I use NMock for mocking. I have scenario where some information is coming from a XML file and I am creating my class objects depending on the values given in that file. This file is shared and multiple programmers are allowed change the value. So when I try to write test for this, it worked one day and stopped working next day as the file data got changed.
I am trying to create mock for this, but I am not getting a start. Can anyone help to get started ?
|
|
|
|
|
Unless the files are quite small, I find mocking the file access to be extremely tedious. What you need is to add the XML files into your test project and have them copied into the bin directory (Right click the XML file in the project and click properties. One of the properties gives you an option to Copy Always to the build/output directory).
You also need one XML file per test so that there is no need for other developers to be changing the files unless they are updating the test. Sometimes you may find that a groups of tests will need to work on the same file. That is fine if you make that clear.
|
|
|
|
|
Thanks colin - I read your this[^] article which talks about the same subject. Under "The real object is difficult to set up" section, you are talking about the database part and it's problems when a test database is used. I also have a similar scenario. In that case how do I mock the object ?
Let me clear it - I need to ensure that, my code is inserting values to a table and it's related values to other table. So how do I use mock objects here ? Just a clue will help me to get started.
|
|
|
|
|
N a v a n e e t h wrote: I need to ensure that, my code is inserting values to a table and it's related values to other table. So how do I use mock objects here ? Just a clue will help me to get started.
Okay - If the application is properly layered your business code will know nothing about the database. Therefore when you are testing your business code you mock the DAL classes (which are acting as the buffer between your application and the database). There will be no database interaction going on, and no need to mock the database itself because your mock objects will be returning the values to the business layer.
If you are testing the DAL layer itself then you may want to mock the database out. However, the way I usually create the DAL layer is that it acts as a proxy to the stored procedures in the database. In this case I don't mock anything out because what I'm really doing is testing the database and the easiest way to do that is through the DAL.
If your DAL is more complex then you may want to mock out the database calls.
However, from what you are saying "I need to ensure that my code is inserting values to a table and it's related values to other table" then what you doing is testing the database itself. Remember you cannot mock the thing you are testing because if you do the test will be flawed as the test will only be testing the mock object.
So, if you are testing the database, its stored procedures and triggers then you are going to have to have your tests create test data in the database for the tests to use. These are more time consuming tests as you will have to reset the database between tests so that it is in a consistent state. I've found that restoring known backups (small backups) to be fairly efficient without getting bogged down in too much T-SQL.
I hope that helps.
|
|
|
|
|
Colin Angus Mackay wrote: ). There will be no database interaction going on, and no need to mock the database itself because your mock objects will be returning the values to the business layer.
Well, my application is perfectly layered (I think). Business layer don't know anything about database and my DAL returns a IDataReader instance to business layer. So I should write a mock object which returns IDataReader instance for testing business layer right ?
Colin Angus Mackay wrote: I hope that helps.
Sure, it helped. Thanks for the reply.
|
|
|
|
|
N a v a n e e t h wrote: Business layer don't know anything about database and my DAL returns a IDataReader
Ah... So it knows it is a database. To me a DAL (Data Abstraction Layer) does exactly that. It abstracts out ANY form of data whether that is a database, XML file, plain text file, web service or whatever.
N a v a n e e t h wrote: So I should write a mock object which returns IDataReader instance for testing business layer right ?
You can do. However, I've found that mocking things like data readers, stream readers/writers and the like get into quite a bit of problems because of the complexity of the object and the way it interacts with the code you are testing.
I only return IDataReaders in simple cases. I normally try and create some sort of DTO (Data Transfer Object) which is a simple class with just a bunch of properties (very easily mocked). One DTO per row. If the DTO is immutable then better still because then you don't have to mock DTOs you can create real ones (there is generally nothing to be mocked in an immutable object because it cannot change once created).
|
|
|
|
|
Colin Angus Mackay wrote: Ah... So it knows it is a database
Colin Angus Mackay wrote: I normally try and create some sort of DTO (Data Transfer Object) which is a simple class with just a bunch of properties (very easily mocked).
This is what I need to do
1 - Select details from a table say "Product".
2 - Generate a "Product" class instance with the values. This will be done by a product factory class.
My initial design was returning IDataReader instance from DAL and supplying that to product factory. Product factory class will read the values and create a "Product" instance. After seeing your comment on DTO, I redesigned it like the following
1 - A product DAL which gets value from DB
2 - This DAL fills a class called "ProductDTO" with necessary properties. This product DTO implements IProduct interface. Finally DAL returns IProduct instance to the business layer.
3 - Product factory takes IProduct instance and creates final Product class.
This works pretty well and I can mock IProduct easily. Is this approach correct ?
In this approach, I see an extra step included than returning IDataReader , which is creating the DTO. So in a performance perceptive, will this be an overhead ? Also you told business layer shouldn't know anything about the underlying datastore - but if I am sure that there won't be any data store other than database, will avoiding DTOs makes sense (I know it's tough to mock) ?
Thanks again for the reply
|
|
|
|