Click here to Skip to main content
       

C#

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
QuestionTwo others BindingNavigators in one form. How?memberCzajo22 Jan '13 - 6:26 
Welcome. I am writing a program to count, which is connected to the database. I added a TabControl control where I want to put different tables in MySQL. I'm trying to drag the tables on the form. However, generating a first BindingNavigator. Even if you copy and set another table in the properties, the latter copied navigator does not work ... Can it do it somehow set to BindingNavigator work for each table?
AnswerRe: Two others BindingNavigators in one form. How?memberMycroft Holmes22 Jan '13 - 15:33 
Please, please get a book on c# programming, work through the examples and get at least a basic understanding of what you are doing. It sounds like you have just downloaded VS and started fiddling around based on an example or 2 you found on the interweb.
 
Do some study, get at least a basic grounding in what you are trying to do and start again!
Never underestimate the power of human stupidity
RAH

GeneralRe: Two others BindingNavigators in one form. How?memberCzajo22 Jan '13 - 21:19 
nice answer... this is program for count. And count will be tommorow so i don't have a lot of time for searching in books because i,m asking here
QuestionRunning an exememberTheGermoz22 Jan '13 - 5:50 
I have the following problem.
 
If I run an exe file clicking on it it works, while if i call it using
ProcessStartInfo start= new ProcessStartInfo();
start.FileName= "myfile.exe";
Process p = new Process();
p.StartInfo = start;
p.Start();
p.WaitForExit();
 
it returns the following error:
IErrorInfo.GetDescription failed with E_FAIL(0x80004005)
 
The exe file runs a query on an excel file
 
Have you got an idea?
AnswerRe: Running an exemembermark merrens22 Jan '13 - 6:07 
Probably a dumb question, but is the path correct? In other words, is what you have at start.FileName correct? Can the file be found? If not, is the exe actually loading but is, itself, unable to find its target?
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
 
me, me, me

GeneralRe: Running an exememberTheGermoz22 Jan '13 - 6:16 
yes the path is correct...I add some details:
 
Basically from assembly main.exe I call myquery.exe.
It returns the error:
IErrorInfo.GetDescription failed with E_FAIL(0x80004005)during myquery.exe execution (myquery.exe starts, so the path is ok, but after some line of code, it stops during a LINQ query on en excel file).
 
The strange thing is that if I run myquery.exe directly, everything work fine (the query is ok)
 
Is it possible something linked to db connection, called not directly??
GeneralRe: Running an exeprotectorPete O'Hanlon22 Jan '13 - 6:51 
Sounds like you need to add some error handling and logging to the exe.

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos

CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

GeneralRe: Running an exememberPIEBALDconsult22 Jan '13 - 7:14 
How are you accessing Excel? I use OleDb to access Excel.
AnswerRe: Running an exememberPIEBALDconsult22 Jan '13 - 6:15 
Sounds like a problem in myfile.exe
SuggestionRe: Running an exemvpRichard MacCutchan22 Jan '13 - 6:34 
You should give the full path of the exe file.
GeneralRe: Running an exememberTheGermoz22 Jan '13 - 6:57 
yes the path is correct...I add some details:

Basically from assembly main.exe I call myquery.exe.
It returns the error:
IErrorInfo.GetDescription failed with E_FAIL(0x80004005)during myquery.exe execution (myquery.exe starts, so the path is ok, but after some line of code, it stops during a LINQ query on en excel file).

The strange thing is that if I run myquery.exe directly, everything work fine (the query is ok)

Is it possible something linked to db connection, called not directly??
GeneralRe: Running an exememberjibesh22 Jan '13 - 7:04 
have you tried to debug your application? since you said the error is while executing LINQ query on a excel file. was the file is located in the right folder the application is referring? can you log the full exception stack so that we may able to find the reason for the error.
Jibesh V P

GeneralRe: Running an exememberTheGermoz22 Jan '13 - 7:14 
you get the point.. the file is in the myquery.exe base directory.
 
From my main project main.exe is possible to include a path for searcing the excel file?
 
Basically in myquery.exe I'm opening the file using no path reference. But I can't change myquery.exe
 
I should include the path (in relative reference) in main.exe. I tried in Proprierties-ReferencePath but here is not possible tu include relative path (I'm not able)
 
My be in pre event command line?
GeneralRe: Running an exememberjibesh22 Jan '13 - 7:34 
If you run an child exe from other exe, the working directory of child exe will be same as that of parent. but you can force the working directory of the child to use its own by setting the working directory as below.
 
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = @"childExepath\myquery.exe";
start.WorkingDirectory = @"childExepath\";
Process p = new Process();
p.StartInfo = start;
p.Start();
p.WaitForExit();
Jibesh V P

GeneralRe: Running an exemvpRichard MacCutchan22 Jan '13 - 7:15 
I would suggest you debug the LINQ query, or add some logging information to the application.
AnswerRe: Running an exememberjschell22 Jan '13 - 8:09 
TheGermoz wrote:
while if i call it using

 
Meaning that the code you posted is running from a console application that does NOTHING else?
 
Or you are running it from an application that does do something else. If so then create a console application that does nothing else and run it from there.
AnswerRe: Running an exememberJoe Woodbury22 Jan '13 - 10:14 
Doing a general search, 0x80004005 means "unable to open registry key"; http://support.microsoft.com/kb/295297[^]
 
The child program may be running under restricted permissions. If run manually, you may be running as and administrator.
GeneralRe: Running an exememberTheGermoz22 Jan '13 - 10:50 
the strange thing is that if in the child program I indicate the full excel file name on which run the code, then I can call and work. Some cases
case 1 (the one I need)
Father program F1 call child C1 where (I mean in C1 code) excel file is indicate as
string myFile ="db.xls"
: doesn't work.
 
case 2
F1 calls C1 where file is indicate as full path
string myFile =@"c:\db.xls"
: works.
 

case 3
if I directly click on C1 where file is indicate as full path
string myFile ="db.xls"
: works.
 
my problem is that I should keep string myFile ="db.xls"
GeneralRe: Running an exememberjibesh22 Jan '13 - 14:50 
can you paste the code how you construct the file path. i.e the code you used to open/load the file.
 
As I said earlier, when you start a child exe, by default the child exe's working directory is parent exe's path.
eg:
C:\Applicaiton\Bin1\Parent.exe
C:\Application\Bin2\Child.exe
C:\Application\Bin2\somefile.xls
 
If you start Child.exe from Parent.exe, the Working directory of Child.exe you are expecting to be 'C:\Application\Bin2\somefile.xls' but its not true. when you start Child.exe from Parent.exe the working dir of Child.exe is same as Parent.exe ie.'C:\Applicaiton\Bin1\Parent.exe' hence the application tries to find a file in Bin1 folder so throws exception.
 
You can force the Child.exe to use Bin2\ as its working directory by setting the ProcessStartInfo.WorkingDirectory = "Bin\..";
Jibesh V P

GeneralRe: Running an exememberTheGermoz22 Jan '13 - 18:55 
thank you very much!! You have completely solved my problem!!!
GeneralRe: Running an exememberjibesh22 Jan '13 - 19:25 
Happy to hear that. Thank You
Jibesh V P

QuestionDrag items to Listviewmemberjenya722 Jan '13 - 4:01 
Hi All,
I have a ListView with 3 groups.
I drag an item from TreeView to ListView:
private void listViewDemo_DragDrop(object sender, DragEventArgs e)
{
    if (!is_listview) //treeview item
    {
        //get a text of a draged item
        string str = e.Data.GetData(DataFormats.Text).ToString();
        //get information about hovered item
        ListViewHitTestInfo hit_info = listViewDemo.HitTest(listViewDemo.PointToClient(new Point(e.X, e.Y)));
        //check position - must be on an item
        if (hit_info.Location == ListViewHitTestLocations.None) return;
        ListViewItem prev_item = hit_info.Item;
        ListViewGroup group = prev_item.Group;
        int idx = prev_item.Index;
        //create a new key
        Guid key = Guid.NewGuid();
        string item_key = key.ToString();
        //create a new item
        //option 1
        group.Items.Add(listViewDemo.Items.Insert(idx,item_key, str, ""));
        //option2
        //group.Items.Insert(idx,listViewDemo.Items.Insert(idx, item_key, str, ""));
    }
}
I expect to add an item in place of pointed item, but any option adds element in the end of the group.
How can i add the item in the spot where mouse hover?
AnswerRe: Drag items to ListviewmemberBobJanova22 Jan '13 - 22:49 
The coordinates in the event handler are probably relative to the object you're dragging off. You might need to use ClientToPoint or whatever it's called to get it in global space before calling PointToClient.
QuestionHow to call a "Windows Form Application" in a "Windows Service"?memberDaKhucBuon22 Jan '13 - 1:40 
Hi everybody,
 
+ I's 02 application:
- application A : a windows service
- application B : a windows form program (a .exe file)
 
and my problem's: when call app B within A's code then B unable get window title of windows although it's working when run B alone.
 
anybody resolve it?
AnswerRe: How to call a "Windows Form Application" in a "Windows Service"?memberPIEBALDconsult22 Jan '13 - 2:21 
Please don't do that. What are you really trying to accomplish?

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 22 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid