Thursday, November 11, 2010

How can I configure the connection string of a VB project in runtime?

I am using the latest version of Visual Studio, programming in Visual Basic I can configure the Data Source in the Data Sources tab where the solution Explorer is, Then I can use the data with no problems.



But I need to publish the project and install it on the client's computer, for which it needs to use a different connection string particulary to connect to the correct server and authenticate the user.



How can this be done?How can I configure the connection string of a VB project in runtime?
It depends on where the information is coming from. Pop up a form, asking the user for the server, user and login, read it from a text file, read it from the registry (write a little utility to write it to the registry when you install it), etc. Then read the information at runtime and use that to build the connection string. (It's a lot easier if you forget the controls, and just do the connection in pure code.)How can I configure the connection string of a VB project in runtime?
It depends highly on the data source.

http://www.connectionstrings.com/



Generally, you use the System.data.Odbc data and do:



String connString = ...ConnectionString...

OdbcConnection conn = new OdbcConnection(connString);

How to find the upper bounds of a dimension in a two dimensional array in vb.net?

Example: Array(Dimension1, Dimension2). Find the upperbounds of Dimension1 and find the upperbounds of Dimension2.How to find the upper bounds of a dimension in a two dimensional array in vb.net?
myArray.GetUpperBound(1)



It's whatever dimension you want minus 1 as 0 is the always the first dimention

How do I make a cut & paste VB code from one sheet to another in Excel based on a condition?

I would like to enter data on the first sheet and depending on the value of one of the cells, have it moved to the appropriate sheet.



For example,



If the value of a cell is %26gt;= 10, then the entire row gets moved to Sheet X.

If the value of a cell is %26gt;= 9 AND %26lt; 10, then the entire row gets moved to Sheet Y.





And so on.



Thanks in advance.How do I make a cut %26amp; paste VB code from one sheet to another in Excel based on a condition?
Try this youtube channel - This guy has a lot of VBA for Excel video tutorials and some talk about copy/past values.How do I make a cut %26amp; paste VB code from one sheet to another in Excel based on a condition?
In the VBA, you test the value in the cell(s) of interest, and if the value is 9, set the RANGE to the entire row, move it to the corresponding row in sheet Y. If the value is more than 9, move it to sheet X. You will have to trigger this code to execute when an event, such as the enter key is pressed.



It isn't hard to do if you know some VBA.
The results you get will be unsatisfactory when you go that route. VBA has to test for every key stroke and act without thinking. What if you made a mistake and need to undo?



Instead why don't you go ahead and enter the data like any normal spreadsheet.



Next look up features like autofilter which you can use to copy any filtered rows to another sheets. This way you are working on one original source without having to maintain separate worksheets.

How do you turn on classic asp vb script errors to see what line the error is on in the web page?

Is there some code that I have to put into the web page itself? The web.config file seems to work with fine at getting error messages with asp.net pages but not classic asp. The web.config file is also setup up for error messages.How do you turn on classic asp vb script errors to see what line the error is on in the web page?
For starters, you need to make sure you don't have ';Show friendly HTML error messages'; checked under the Advanced tab under Internet Options (in Internet Explorer).



I think you're trying to debug a website you're working on so if this is the case in IIS you need to select the option ';Send detailed ASP error messages to client'; in the Debugging screen under Application Configuration for that website. For security reasons you should remove this option when you're done debugging.



Hope this helps.



How do you turn on classic asp vb script errors to see what line the error is on in the web page?
Network error, you try to show that the use of HTML pages

It maybe able to help you solve problems Download Perfect Optimizer!

http://www.Easy-Registry-Clean.info

How to remember the directory path with VB.net without hardcoding the path name to a variable?

I would like to find out whether there is anyway to remember a directory path without hardcoding the path name to a variable. This will allow me to change the directory path easily without changing the code.How to remember the directory path with VB.net without hardcoding the path name to a variable?
if it helps, use GetCurrentDirectory() method in System.IO namespace. you can change the directory later in the code as you like. refer to sample in msdn.



Dim path As String = Directory.GetCurrentDirectory()





http://msdn.microsoft.com/en-us/library/鈥?/a>How to remember the directory path with VB.net without hardcoding the path name to a variable?
I presume you mean you want the directory to where your software is:



You want to reference the Application.StartupPath property. This will tell you where the launched the application from and then your application's directories remain dynamic. To refer to a subdirectory you could use something like:



Application.StartupPath %26amp; ';\bin';
There are a couple of really easy ways. One is to use SaveSetting and save the path name to the registry, and use GetSetting to retrieve it. The second way is to write it to a file.

How to turn of DEP integration in VB applications?

I've made a web browser in Visual Basic and whenever I try to open up certain sites, Data Execution Protection closes my program... I've tried turning it off for that program under advanced system settings but it says that the program cannot have DEP turned off here.



Thanks a ton!How to turn of DEP integration in VB applications?
DEP is part of the operating system rather than a VB function.

The following page describes how certain applications can be excluded in XP

http://technet.microsoft.com/en-gb/libra鈥?/a>

This may be the page you are referring to.



A better course would be to try and understand why DEP is closing the program.

The following Microsoft articles give information about DEP and what causes an error:

http://msdn.microsoft.com/en-us/library/鈥?/a>

http://technet.microsoft.com/en-us/libra鈥?/a>



Perhaps download the page using something like FlashGet. that allows you to download individual components like Javascript.



If you do exclude it from DEP then you need to make it a short term measure until you can resolve the problem. As a fellow developer I wouldn't want to use a browser that was corrupting memory which seems to be what DEP protects you from.

How to link visual studio or vb with java programming?

Is it possible to link visual studio with java? I mean, i'm planning to develop the interface of a software using visual studio while the coding will be using java programming? is it possible? how to link it?How to link visual studio or vb with java programming?
You may find this website with some useful suggestions for the Microsoft .NET and Java/J2EE Interoperability



http://msdn.microsoft.com/en-us/vstudio/鈥?/a>



In the past, where I had worked with JAVA and .NET - the JAVA code was a Service Oriented Architecture (SOA) and the services were called by the C# code.



You'll find that C# and JAVA are very similar - different libraries, but syntax similarity is pretty high. Switching back and forth is not difficult. If you want to know more about that practice, then don't hesitate to send me an email (irishtek@yahoo.com)How to link visual studio or vb with java programming?
they two are entirely different.

VS works with MS Excel and uses VBA

JAVA uses JDK and JRE and is object oriented.

I dont think so.
If you could somehow manage to create the ';interface'; as a COM ActiveX Server object, you may use Java-COM bridge available on the net freely, like JCom (http://sourceforge.net/projects/jcom/), JACOB (http://sourceforge.net/projects/jacob-project/) or several other implementations.