Sunday, August 2, 2009

Application.StartupPath (VB--Visual Studio 2005)?

I have a program (my first where I made up all the code instead of copying it out of a learn-to-program book!) that needs to use a .txt file as input. I've been using the line:





FileOpen(1, "C:\Folder Name\FileName.txt", OpenMode.Input)





but I wanted to change the hard coded path to use Application.StartupPath instead so that if people put it somewhere other than the C drive it would still work. So I used the line:





FileOpen(1, Application.StartupPath %26amp; "\Folder Name\FileName.txt", OpenMode.Input)





but then my code wouldn't debug properly.





I get an error message when I try to debug that says:


Could not find a part of the path 'C:\Folder Name\Folder Name\Folder Name\bin\Release\Folder Name\FileName.txt'.





What am I doing wrong?





Thanks!

Application.StartupPath (VB--Visual Studio 2005)?
Not a simple problem. You do nothing wrong. Windows (more exactly - VB) does some unclear things.


"Working directory", as Microsoft thinks, is sometimes directory of "current user home directory", sometimes "c:\", depending on what buggy Windows version you use.


You need to use GetModuleFileName funcrion from Win32 API to obtain full pathname of your executable. Then you need to strip filename (after last backslash) - and you will get current directory where your program is placed.
Reply:Make a button n write this lil code....





Dim ofd As New OpenFileDialog()


Dim dia_result As DialogResult = ofd.ShowDialog()


If dia_result %26lt;%26gt; DialogResult.Cancel Then


Dim fstream As New FileStream(ofd.FileName, FileMode.OpenOrCreate, FileAccess.ReadWrite)


Dim sw As StreamReader = New StreamReader(fstream)


Dim temp As String = sw.ReadToEnd()


'write the file to a TextBox1


TextBox1.Text=temp





end if


.net visual studio 2003 help plz?

hi..


i can able to create new windows applns,


but unable to create web application..


the error is..


Unable to create Web project 'webapplication1'. The file path


'c:\inetpub\wwwroot\webapplication1' does not correspond to the URL


'http://localhost/Webapplication1'. The two need to map to the same server location. HTTP error 403:forbidden.











i have win server 2003, and installed iis also..


what r the possible problems..


plz help me..

.net visual studio 2003 help plz?
Honestly, In not sure what your problem is- but I do know something that could be a solution for you anyway.





Microsoft is giving away Visual Studio 2008 for free(to college students). Installing a newer version will probably eliminate your problem(in a roundabout way).





You have to prove your a college student, you might have to sign up at www.journeyed.com but you getting free software out of it. After that you download an iso(visualstudio.iso or something), mount it with alcohol 120% or Daemons tool and install.


Inline functions in VC++ (Visual studio 6)?

I was told that Inline functions in C++ work like macros in C


saving the 'overheads' before and after function calls.


But Disassembly window in VC++ shows other wise. Here is the code..





inline double InlSquare(double x){return(x*x);} //inline


#define MacSquare(x) (x)*(x) //Macro





int main(void){double a=2.5,b=0,c=0;


b=InlSquare(a);


c=MacSquare(a);


return(0);}





Here is an excerpt from VC++ Disassembly with 'Source annotation'-


9: b=InlSquare(a); // inline Function


mov eax,dword ptr [ebp-4]


push eax


mov ecx,dword ptr [ebp-8]


push ecx


call @ILT+10(InlSquare) (0040100f)


add esp,8


fstp qword ptr [ebp-10h]





10: c=MacSquare(a); // Macro Function


fld qword ptr [ebp-8]


fmul qword ptr [ebp-8]


fstp qword ptr [ebp-18h]





After the "Call @ILT+10" instruction we encounter push and pops


push ebp


mov ebp,esp


sub esp,40h


and many more..'over heads' before the execution of fld,fmul and fstp etc.





Is there any way to make inlines work like C Macros ?

Inline functions in VC++ (Visual studio 6)?
The link below would have the answers you need.





To summarise it for you, VC does have a way of forcing inline functions to be like macro that is '__forceinline'





I do not know why you want to force the inline functions to work like macros, but take a read at the link below and see why it's not recommended to use __forceinline.





Hope this helps.


How can I make a "global object" in C++ (VS2005) similar to how I would in VBA?

In VBA I have always creates global objects by defining them at the global level like this:





public myObject As myClass





How can I do something similar in Visual Studio 2005 with C++?





Currently I have a button, text box, main(), and an event handler for the button. Where do I define the object so that when the event handler is called it can always access to object?

How can I make a "global object" in C++ (VS2005) similar to how I would in VBA?
You do it essentially the same way. You declare the object outside the scope of any function, including main(). In some cases you might want to make it static.





This is, of course, in general an extremely poor design practice.





#include %26lt;iostream%26gt;





using namespace std;





class A


{


public:





A() {cout %26lt;%26lt; "hello\n";}


void print() {cout %26lt;%26lt; "print\n";}


~A() {cout %26lt;%26lt; "goodbye\n";}


};








A a;





int main(int argc, char *argv[])


{


a.print();


}
Reply:you declare public attributes of the class lis this





class myClass


{


public:





}


then you create an instance of that class in main.

spring flowers

Friday, July 31, 2009

Where can I find Visual Studio 6.0?

I just finished a semester of Visual Basic at my school and I love it. Right now I am in another semester and I am taking c++ and thats a lot of fun too. I was just wondering where I can find VS 6 because i searched best buy and target and they dont have it. SO is their anywhere I can find it. And another thing can someone tell me a price range.

Where can I find Visual Studio 6.0?
Can't beat the price. Free.





http://msdn.microsoft.com/vstudio/expres...





enjoy...
Reply:Try www.isohunt.com
Reply:on the internet
Reply:It is a very expensive product to find without ordering it. I bought mine from my school's library for around $300.
Reply:you can get it for FREE, I got it from Microsoft online for free.


My C# program fails to establish connection to SQL Server during Data Form Wizard on Visual Studios. Why?

I was trying to create a program that would retrieve information from an SQL Server database, located at the Master folder, but the error message provided was "Server does not exist or access denied". I already added the SQL Server name, and set it on "NT Authetication", since I did not specify the username and password for the server itself. What went wrong?

My C# program fails to establish connection to SQL Server during Data Form Wizard on Visual Studios. Why?
A couple of things to try:





Can you ping the server from your PC? Drop to a command prompt and type in Ping ???? where ???? is the servers name. Can you ping it? If not, verify the servers IP address by going to the server and typing at a command prompt


ipconfig /all





It'll display it's IP address and you should then see if you can ping it from your development PC. If you can, use the IP address in your connection string.





If you can Ping it see if you can telent to it. MS SQL Server listens on port 1433. Drop to a command prompt and type in


Telnet ???? 1433


Does the command prompt screen clear with a cursor blinking or does it return an error? If it returns an error then the server is not listening. Make sure SQL Agent is running and make sure that the server is actually running by going onto the server and starting the Enterprise Manager or Management Studio and see if you can do some queries.
Reply:from all my experience in .NET programming, i know you always need a user id and password on a database, even for a sample coding/ trying out..





why dont u create a simple user id of 'test' with a password '1234' then give it a permission of a normal user. it should be able to work..





also, another thing can be wrong is the configuration of your connector. if you are using odbc or msodbc, be sure to check its configuration. a number of times i got this not configured and ending up getting the same error message as yours





hope that helps and do note that just setting up a database for connection and data retrieval may take up to a whole day even for seasoned programmers
Reply:Is your SQL Service running?


Start--%26gt;Run--%26gt;services.msc


In services Look for:


SQL Server started


if it is blank you need to start it. right click and start.
Reply:What's the connection string?





Does the SQL Server support TCP/IP connections?


How to make a website written in c#.net into an executable file?

i have made a website with certain linked pages in C#. net (visual studio 2005) and i have to put it on our institution LAN.Pl advice how to package it and make it executable so that i can see the site across the net work from any computer.

How to make a website written in c#.net into an executable file?
Web applications are not compiled into executable files but rather into another kind of assemblies.





All you need to do now is deploy or publish your application on your webserver and there are a number of ways to do this.





You can read about deploying ASP.NET applications here:


http://www.codeguru.com/csharp/.net/net_...


http://www.beansoftware.com/ASP.NET-Tuto...


http://www.c-sharpcorner.com/UploadFile/...





Hope this helps.