|
I'm working on a custom control that extends DataGridView.
It has a Form as its custom property editor, like property pages we had in VB6.
The property editor is simply another form popped up when a designer verb of the control is selected.
This form contains the interface required to specify the columns to be added to the parent datagridview instance.
When I use the costom datagridview control in a form and specify some columns to it, they are visible in design time, this is what i was upto. The problem is that every time I edit the grid instance throught the custom property editor a new set of columns are added into froms source. However, the previous ones are detouched from the grid but remain in the code page, cluttering up the source.
I would vastly appreciate help/suggestion in accomplishing two things,
1. Being able to Programatically specify the names of the columns (e.g. PersonName_col, insted of the default dataGridViewTextBoxColumn1...)
2. if the above is no allowed, a process of cleaning up the recedue (detached from the grid) columns from the forms source.
I'd be obliged to salute anybody who can understand what I'm trying to say, cause I myself am not very sure if have said it meaningfully enough. Nevertheless this is the place where I've seen many wonders take place.
Gratitude in advance to the kind heart(s) that will even attempt to help me out.
(Its oh so hard for me to keep it short)
Galib Anwar
A C# shortimer.
|
|
|
|
|
Hi...
I`ve done a COM DLL (using C#.NET 2.0) to use in my VB6 app. OK. It worked well in my dev computer where i compiled it and let VS2005 register it for COM Interoperation.
But I need to use this COM DLL in another development enviroment (and further put it in a production enviroment) without VS2005. I`ve tried the regasm utility and intellisense works there in VB6, but I get an error when I try to run my project (Automation Error. The system cannot find the file specified").
Any hint?
Thanks
|
|
|
|
|
I think you either need to add a reference to the dll project, or the path to the dll to your development environment's search path.
|
|
|
|
|
You could try REGASM Assembly.DLL /CODEBASE. That way the current location of the assembly is recorded in the registry.
David
|
|
|
|
|
Hi,
I'm using a DataGridView to display data from a Dataset which contains a few tables.
I'm binding the DataGridView to the DataSet by DataGridView.DataSource and DataGridView.DataMember.
All goes well up to a point when I read new data into that DataSet (I read a new xml file into that DataSet using DataSet.ReadXml).
from this point and on the DataGridView remais the same and doesn't update according to the new data in the DataSet.
Even if I set the DataGridView.DataSource to Null and that back to that Dataset it doesn't help.
Any help is appreciated.
tnx
Roy
|
|
|
|
|
Hello everyone,
Is there anyway to fix the column size in a ListView so the user cannot move them around (Increase or Dicrease the column width)?
I am able to set the size using the following line of code:
listView1.Columns.Add("Tables", 150, HorizontalAlignment.Left);
Thank you so much for your time and have a great day.
Khoramdin
|
|
|
|
|
Change the HeaderStyle or ColumnStyle or something like that to NonClickable and I think that disables the resizing.
|
|
|
|
|
Hi
I am trying to install a setup kit using c#. During installation, db folder and output xml folder has to be configured. I have configured as
c:\program files\xy z technologies\DB\ and
c:\program files\xy z technologies\xml\
I am also checking for the existence of that particular folder. If the folder exist, it should automaticlally install otherwise, create the folder and install.
I tried both by giving exact folder name and also without folder name, but in both cases, it is failing and giving an error message as
System.io.filenotfoundexception. file or assembly name or one of its components does not exist.
what could be the problem.
If I had given the folder name without any space (c:\dbfolder, c:\xml) then (without space between folders) i am able to install the kit. if space given in between folder name (say for example "program files"), i am not able to install the kit. what could be the reason
Jtamil
|
|
|
|
|
Try putting the folder name between quotation marks.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
this is the code that i am using in my installer
base.Install (stateSaver);
assemblypath = this.Context.Parameters["assemblypath"].ToString();
appConfigPath = assemblypath + ".config";
try
{
strDbFolder = this.Context.Parameters["DBFOLDER"];
strGenerateFolder = this.Context.Parameters["GENERATEFOLDER"];
strImageFolder = this.Context.Parameters["IMAGEFOLDER"];
if ((strDbFolder == "")||(strGenerateFolder == "")||(strImageFolder == ""))
{
throw new InstallException("Directory path not specified");
}
if (!Directory.Exists(strDbFolder))
{
throw new InstallException("Directory path for DB Folder <" + strDbFolder + "> is invalid");
}
if (!Directory.Exists(strGenerateFolder))
{
throw new InstallException("Directory path for Generate Folder <" + strGenerateFolder + "> is invalid");
}
if (!Directory.Exists(strImageFolder))
{
throw new InstallException("Directory path for Image Folder <" + strImageFolder + "> is invalid");
}
doc = new XmlDocument();
doc.Load(appConfigPath);
SetValue("//appSettings//add[@key='DBFolder']", strDbFolder);
SetValue("//appSettings//add[@key='GenerateFolder']", strGenerateFolder);
SetValue("//appSettings//add[@key='ImageFolder']", strImageFolder);
doc.Save(appConfigPath);
}
catch (FormatException e)
{
string s = e.Message.ToString();
throw e;
}
catch (Exception ex)
{
throw ex;
}
|
|
|
|
|
Do the path variables (strDbFolder, ..) contain the correct values so the problem lies within the Directory.Exists method or are they already retrieved incorrectly?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I have given the correct directory path
|
|
|
|
|
The question is whether they are correctly retrieved at runtime. What do the paths look like that are incorporated into the messages of the InstallExceptions? Are they correct?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I ve tried
System.Windows.Forms.MessageBox.Show(strDbFolder) in all the places (right from the begining). but this error message is not displayed at all, but if i am giving a folder name without any space, then the message box is displaying. I am not able to give a message box of the path during installation
|
|
|
|
|
Don't you get the message of the install exception, which is thrown if an directory does not exist, during installation (the paths are incorporated in those messages)?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
i am getting io exception. The path that i have specified in strdbfolder exists, but still i am getting io exception
|
|
|
|
|
I've tested the Directory.Exists method and it definitely has no problem with space characters within folder names. At least that the case in a windows application, but I doubt the behaviour changes in an installer. Also it is not specified that the method throws any exception; it simply returns a boolean value.
What statement throws the IO exception?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi ! I have to create a new software in C# which will always RUN in the background. I want to show the GUI only when the user click on the icon in the icon tray (resident program). The program must run by itself each time the system (PC) is power up.
How we do it ?
Note: I have checked with my Visual Studio 2005 in the New Project option but I don't see anything that seems to be a SERVICE (or resident program).
How I must create the project ????
Thank you.
Danny Gilbert, engineer
Montreal, Canada
|
|
|
|
|
Create a new Project, and in the Project Types treeview, select "Windows" and then "Windows Service".
You'll probably want to make 2 programs. The service itself, and then a small Windows app to act as an interface for it.
|
|
|
|
|
Hey guys, i have a thread i created that loops in a while loop it also has 3 functions in it:
1 being:
private void PrintRecord()
I set up a delegate in the thread so that when the delegate is called it "should" make the thread do this function. When it does it still "hangs" the main form and it should really do the work behind the scenes without interupting the main form. Can someone point me in the right direction to what i am doing wrong?
Thanks In Advance,
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Please post the relevant code. Help us to help you.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thank you for the reply. Below is what i have going on:
This is where i create the thread
m_objPrintThread = new PrintThread(m_objUV, this, m_sRecKey, m_DailyRec);
m_objPrintThreadID = new Thread(m_objPrintThread.ThreadStart);
m_objPrintThreadID.Start();
This is what is basically going in the thread. There are three functions I only put one in here to save space.
namespace CashRec
{
public delegate bool PrintCashRec();
class PrintThread
{
UONET m_objUV;
string m_sKey, m_sRec;
frmMain m_form;
volatile bool m_bShouldStop = false;
public PrintCashRec m_PrintRec;
public PrintThread(UONET objUV, frmMain form, string sKey, string sRec)
{
m_form = form;
m_objUV = objUV;
m_sKey = sKey;
m_sRec = sRec;
m_PrintRec = new PrintCashRec(Print);
}
public void ThreadStart()
{
while (!m_bShouldStop)
{
Thread.Sleep(500);
}
}
public void ThreadStop()
{
m_bShouldStop = true;
}
private Boolean Print()
{
bool bSuccessful = false;
while (!bSuccessful)
{
}
return bSuccessful;
}
Here basically i am calling the delegate and i would expect it to just signal the thread to call the print function without it hanging the main form. But it still hangs the form.
private void mnuPrint_Click(object sender, EventArgs e)
{
if (m_objPrintThread == null)
{
if (StartPrintThread())
m_objPrintThread.m_PrintRec;
}
else
m_objPrintThread.m_PrintRec;
}
Thanks again for your help
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
As a quick answer, it seems to me that you are calling a not-threaded method, while the threded one does nothing (only sleeps). But I'm in hurry hence I can't give a better look at your code. Maybe tomorrow you'll get a better answer.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Is the objective of your code to display a record to a control on the main form? If so you need a different approach to the problem so check out the InvokeRequired property of forms.
Phil
|
|
|
|
|
what the thread does is prints documents to a printer. Reason why i have it in a thread is it builds the record to print. If i did this on the main thread it would lock up the GUI for about 10/20 seconeds which is would make the user think that the program is locking up. What i did as a work around is create 3 flags in the thread. Every 1 seconed it will loop and check for those flags and if one is true it will do the function that corresponds to that flag. It does work fine but i don't think it is the right approach.
Thanks for the reply,
Don't be overcome by evil, but overcome evil with good
|
|
|
|