Martje

Can you pleas help me sir

Martje Junior Poster in Training

My code was working Great! until i added a vector named "resudibus"to my namespace in a windows form.

#pragma once
#include <Windows.h>
#include <msclr\marshal.h>
#include <iostream>
#include <string.h>
#include <vector>
#include <fstream>
using namespace std;
using namespace System;
using namespace System::IO;
using namespace msclr::interop;

namespace Project1 {

    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;

    /// <summary>
    /// Summary for MyForm
    /// </summary>

    std::vector<int> resudibus(1);

it gives me the following error messages :
WinCLI.obj : error LNK2005: "class std::vector<int,class std::allocator > Project1::resudibus" (?resudibus@Project1@@3V?$vector@HV?$allocator@H@std@@@std@@A) already defined in MyForm.obj

1>fatal error LNK1169: one or more multiply defined symbols found

But i am sure that i havent declared this file anywhere else, when i remove it everything starts to work as usual... What am i doing wrong here?

Martje Junior Poster in Training

I am having a dialog box opens that lets you select a picture and then copy that picture to another folder but the problem is that i am having an error that says that i can't convert a System::String to a LPCTSTR.
I searched this subject on google but i spent the whole day trying to figure it out.
How should i convert a System::string to a LPCTSR?

if ( openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK )
            {
                strpic=openFileDialog1->FileName;
                CopyFile(strpic,L"pic/",false);
            }

Martje Junior Poster in Training

Hey guys,
I am having a problem where i want to print a image and a simple string.
i would want that when i print i get this on paper : Click Here For Image

I looked up printDocument, printDialog and printPreviewControl from MSDN and got a few examples but i did not really understand them, i looked up this topic on Google but its very little discussed.

I don't know the procedure on how to print to paper so if someone can explain to me how its done it would be very appreciated or if you can make an example code snippet i would be very thankful.

Thank you in advanced

Martje Junior Poster in Training

Hey guys,
You know when you are about to buy an item online you have to insert your address, etc and after a few days you will receive the product at the address you provided.
Well i am setting up an online business that offers products but i am stuck because i don't know where i should go or which companies offer these kind of services.
If you know any companies that offer these services pleas let me know and if you had experience with any of them also let me know as it would be great.
Thank you in advanced.

Martje

Thank you very much.

Martje

Yes i want to capture it in place of a button press (like you would in an instant messenger)

Martje Junior Poster in Training

I have been trying to capture the enter key in a windows.net textbox but i have no idea how to do it, i googled searched but the only examples i find are visualbasic and c# ones and when i try to do thesame thing in c++ in doesnt work.

I am using visual c++ express 2008 and i am working with windows forms(.net)
I hope thats enough information for you guys to be able to help me.
Thanks in advanced.

Martje

Thank you Jonsca,

and next time i will describe my topics and post's better.

Thank you,

Martje

Yes i do, i cant figure out a way to do this.
When i give it a empty string it gives me a segfault.

Martje Junior Poster in Training

Hi all,
I add picture to my pictureBox by writing the following code : [ICODE]pictureBox->BackgroundImage = System::Drawing::Image::FromFile()[/ICODE]

But how would i remove that image ones i am done using it?

Thank you in advanced.

Martje

Nevermind, i already got the answer.

Martje

Yes i think thats what i am going to do.
Thank you.

Martje

[QUOTE=jonsca;1422050]Are you trying to get the filename back from something you've assigned earlier to the BackgroundImage property?[/QUOTE]
Yes.

Martje Junior Poster in Training

How would i get an imageBox Background image file location ?
Thanks in advanced.

Martje Junior Poster in Training

Hey guys,

How would i get an imageBox Background image file location ?
Thanks in advanced.

Martje

yes its a visual studio list box, after a more serious and very deep research i found the answer...
i had to use listBox1->Items->Count

thanks for your help man, i feel like a dorn tho cause the answer was infront of my face :P

Martje

yeah its returning an object thing, i did not found any similar functions tho...

Martje

converting a int to a string works but i am noticing that listBox1->Items isnt returning a number...
i really have no idea how to return the amounts of items i currently have in a listBox.

Martje

Ah now i understand your point,
i have a listitem box with 3 items(item1,item2 and item3) i want my messagebox to tell me that i have 3 items so when i use show() its suppose to tell me 3.

If you dont understand what i want tell me and ill try to explain better(my english is a little bad so pleas have patience with me)

Martje

With no luck i mean that i dont have any idea how to do what i want to do and you are right that show() doesnt take a numeric value but even when i convert it to string i am not getting what i want.

Martje Junior Poster in Training

How do i get the number of items a itembox is carrying?
I tried [CODE]MessageBox::Show(listBox1->Items);[/CODE]but no luck
Thanks in advanced.

Martje Junior Poster in Training

Hey,
i have a CLR proyect where i have 2 forms, i am trying to acces the form1 class via form2.

what i did is that i included the header.h of the form in form.h but it failed so i went back and icluded thesame folder both of them are there and then it compiled fine.
then i tried to acces form1.h but it doesnt locate anything in the header so then i made a function in form1.h and not even that it wont located it wont locate.

Martje

thank you

Martje Junior Poster in Training

I am trying to write \r\n as a string but when i do it apears as a newline.
Here is the code i am using : [CODE]textBox1->Text="test"+"@\r\n";[/CODE]
but it shows as :
[QUOTE]test@
[/QUOTE]

how would i let it show as [QUOTE]test/r/n[/QUOTE]?

Martje

I figure the problem out, i was including my form2.h at the top before windows.h, and other includes.

Martje

I readed some of the links you posted but i am not trying to combine managed and unmanaged code.

I went to : project->add new item->forms

i made my form but now i want to include it in my first form so i can show it.

Martje

i am using visual c++ 2008 and both are managed code(CLI)

Martje

I am using the default compiler visual c++ comes with

Martje Junior Poster in Training

I made a second form but whenever i try to put it in my project i get lots of errors.
I am just puting : [CODE]#include "Picture_viewer.h[/CODE]

but i am getting list of errors :
[QUOTE]1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(5934) : error C2872: 'IDataObject' : ambiguous symbol
1> could be 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(251) : System::Windows::Forms::IDataObject IDataObject'
1> or 'c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll : System::Windows::Forms::IDataObject'
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(5934) : error C3699: '' : cannot use this indirection on type 'IDataObject'
1> compiler replacing '
' with '^' to continue parsing
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(5948) : error C2371: 'IDataObject' : redefinition; different basic types
1> C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(251) : see declaration of 'IDataObject'
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(6110) : error C2872: 'IDataObject' : ambiguous symbol
1> could be 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(5948) : IDataObject'
1> or 'c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll : System::Windows::Forms::IDataObject'
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(6123) : error C2872: 'IDataObject' : ambiguous symbol
1> could be 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(5948) : IDataObject'
1> or 'c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll : System::Windows::Forms::IDataObject'
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(6136) : error C2872: 'IDataObject' : ambiguous symbol
1> could be 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(5948) : IDataObject'
1> or 'c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll : System::Windows::Forms::IDataObject'
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(6171) : error C2872: 'IDataObject' : ambiguous symbol
1> could be 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(5948) : IDataObject'
1> or 'c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll : System::Windows::Forms::IDataObject'
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(6184) : error C2872: 'IDataObject' : ambiguous symbol
1> could be 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(5948) : IDataObject'
1> or 'c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll : System::Windows::Forms::IDataObject'
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(6282) : error C2872: 'IMessageFilter' : ambiguous symbol
1> could be 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(263) : System::Windows::Forms::IMessageFilter IMessageFilter'
1> or 'c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll : System::Windows::Forms::IMessageFilter'
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(6282) : error C3699: '*' ...