|
I can't believe I haven't been able to find any way to clear the console
screen in vb.net.
All I want is to clear the console screen just like issuing a cls command
at a command prompt.
Does anyone out there know how this is done?
|
|
|
|
|
You could try P/Invoke'ing the FillConsoleOutputCharacter function. See MSDN Library for details.
|
|
|
|
|
Thank you!
I found it in the MSDN libraries url is http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b319239
if anyone is interested. A WHOLE lot of work just to clear the console,
I can't believe they didn't include this functionality in the Console
namespace.
Oh well, maybe next time. Thanks again!
|
|
|
|
|
If it's any consolation (no pun intended), there's no function for this that I can see in the C runtime library either - I was going to look at the implementation if there was one.
In case anyone else wants that article, clickety[^].
|
|
|
|
|
|
I have two datatables which are populating from two different tables of two different databases. I want to get all the records of first datatable which are not in 2nd datatable. I ‘m using the following piece of code.
odr = oDs.Tables(0).Select("Sno = (SELECT SNO FROM " + Convert.ToString(oDataSetChanges.Tables(0)) + ")")
or this one
odr = oDs.Tables(0).Select("Sno NOT IN (SELECT " + Convert.ToString(oDataSetChanges.Tables(0).Columns("SNO")) + " FROM " + Convert.ToString(oDataSetChanges.Tables(0)) + ")")
or I tried the following code as well
oDv1.RowFilter = "Sno NOT IN (SELECT SNO FROM " + Convert.ToString(oDv2.Table) + ")"
where SNO are the primary key columns of both tables but by using all these code I got the same syntax error that is
Message "Syntax error: Missing operand after 'SNO' operator."
Kindly help me in this reagard ASAP
Thanx in advance
|
|
|
|
|
I don't think this is possible. The Select() method doesn't have the full power of SQL - it can only define fairly simple filter expressions.
You can set up relations between tables in a DataSet with the Relations property to set up a parent/child table relationship; however, I don't think you'll be able to do this in this case - I don't think it'll help.
I'd recommend - assuming that your data is coming from at least one SQL Server - setting up a link between the two servers (so that server A can see the table on server B) and performing the difference operation in a stored procedure. You can then use the full power of SQL.
--
Mike Dimmick
|
|
|
|
|
hi mike
thanx for ur reply. i used ur opinion i.e linked both the sql servers via enterprise manager now tell me plz how much it will take effect on the execution performance with respect to time than that of disconnected datasets.
regards
Aamir
|
|
|
|
|
SQL Server uses OLE DB internally to access and manipulate tables of data. It's optimised for manipulating data sets.
As long as the connection between the two servers is at least as fast as the connection between the client and the two servers, you shouldn't see any difference.
Indeed it might even be quicker than two datasets, because SQL Server will tend to fetch rows from the linked database and its local database asynchronously, whereas you typically fill your local datasets synchronously, waiting for the first to complete before asking for the second. (I believe you could do this yourself by using BeginInvoke to perform both operations on the thread pool, then wait for both IAsyncResult.AsyncWaitHandle s to be signalled).
Your experience may vary and, as always with performance, you should measure it rather than guessing. Query Analyzer can show you the query execution plan and the time taken to execute the query.
If the link between the servers is slow (perhaps they're located far apart, geographically?) you could consider replication instead.
|
|
|
|
|
thnx for replying
yes in my case the servers are far apart like for example one in US n other in SingaPore so can u tell me how i use replication as i have no idea of replication. i'll b very thankful to u
regards
aamir
|
|
|
|
|
I could regurgitate a whole load of documentation here, but I won't: I'll just direct you to SQL Server Books Online[^] - note, this link is to a download, not online documentation.
In the Contents tab, go to Replication.
Snippet:
When to Use Replication
With organizations supporting diverse hardware and software applications in distributed environments, it becomes necessary to store data redundantly. Moreover, different applications have different needs for autonomy and data consistency.
Replication is a solution for a distributed data environment when you need to:- Copy and distribute data to one or more sites.
- Distribute copies of data on a scheduled basis.
- Distribute data changes to other servers.
- Allow multiple users and sites to make changes then merge the data modifications together, potentially identifying and resolving conflicts.
- Build data applications that need to be used in online and offline environments.
- Build Web applications where users can browse large volumes of data.
- Optionally make changes at subscribing sites that are transparently under transactional control of the Publisher.
If you always want the latest data available to your client, and cannot stand any stale data, stick with linked servers. Otherwise replication should produce less traffic between servers.
|
|
|
|
|
Not sure about you guys but I often need to paste the output of console apps into emails, documents, and the like so what I normally do is:
dir /s > test.txt
Then open up "test.txt" and then copy and paste the contents to wherever I need it and then delete "test.txt" now this is a pain and I thought there has to be a better way. So I wrote a utility in VB.Net to solve the problem. I would have written this as an article but the .NET Framework has made this so simple the article would be too short
1. Create a new console application
2. Add a Reference to System.Windows.Forms
3. Paste this code into the Main function
Dim strInput As String
strInput = Console.In.ReadToEnd()
Windows.Forms.Clipboard.SetDataObject(strInput, True)
4. Compile and put the resulting .exe in your path
Now all you need to do is:
dir /s | YourProgramName.exe
Then go into your email, document, etc. and paste... the program has captured the console output and put it into the clipboard. Hope you guys find this helpful.
|
|
|
|
|
I finishing up some code I wrote for a multi server chat that uses TCP/IP and Telnet, and I was wondering if there was any interest for it on this site. Its writen in VB.net and its completely convertable into a MUD, data pipe, or FTP system. If there is enough interest I will post all of the source. I hope you guys like class files, cause darn near the whole thing is made up of em
|
|
|
|
|
Maybe you should submit it as an article. I'd certainly be interested in reading it.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
LearnVisualStudio.Net
|
|
|
|
|
This would definitely interest me...
|
|
|
|
|
Hi, Does anyone know how to use the plug-ins api available with VB6. I can't find any documentation for it or anything. Thanks in advance
Allan
|
|
|
|
|
Hi,
I'm trying to setup my VB executable to pull in a parameter when the executable is called.
For example: MessageOperator.exe /B
Here is what I've setup so far:
Public Class MessageOperator
Public Shared Sub Main(Optional ByVal strOption As String = "A")
if strOption = "A" then
...
else
...
end if
At compile time I'm getting the following error:
No accessible 'Main' method with an appropriate signature was found in 'MessageTheOperator'.
I'm either doing something stupid or heading in the right direction, but missing one small item.
Anyone have a suggestion?
Kevin
|
|
|
|
|
In VB, the command line parameters are read from a function (like "Command"). They are not passed into the Main as parameters. Remove the parameter from Sub Main and re-code it to read the parameter from the Command function and you should be all set.
Mike Mestemaker
|
|
|
|
|
Thanks,
I did the following and it worked like a charm:
Dim strMode As String = Microsoft.VisualBasic.Command()
If strMode = "Report" Then
MsgBox("Print Report")
Else
MsgBox("Display Form")
End If
The program is executed:
program.exe Report
Thanks again!! Kevin
|
|
|
|
|
The problem was that you didn't have the signature of your Main correct, rather than using the Microsoft.VisualBasic compatibility namespace you could do the following:
Public Shared Sub Main(ByVal args() As String)
Dim strMode As String
If args.Length > 0 Then
strMode = args(0)
End If
If strMode = "Report" Then
MsgBox("Print Report")
Else
MsgBox("Display Form")
End If
End Sub
|
|
|
|
|
I tested your suggestion and it also worked very well.
Thanks!!
|
|
|
|
|
Hi Kevin, Ben here,
I guess you will be proud to know that you can at least help me on this 'Sub Main' issue. I have just started doing my first project in VB.NET. When I try running my project i get an error code indicating that 'Sub Main ' is missing . Could you please explain to me what this 'Sub Main' is all about, and how I can include it in my project.
Regards,
Ben
|
|
|
|
|
With VB you can designate where you want your application to start. For example you might want it to start with a form, a class or a module. If you start with a class or module VB is looking for Sub Main by default.
When you look at your project in Solution Explorer you'll see a list like the one shown below:
Solution test (1 project)
test
References
AssemblyInfo.vb
Class1.vb
Form1.vb
Right click on the second line (which is test above) and left click on properties.
You'll see a drop-down menu called "Startup object". Pull that menu down and select what sub routine or form you would like your application to start with.
Instructors of VB intro courses always seem to code in the form. This is fine for small financial calculator projects that they have you create while training, but when you start coding larger projects and have multiple forms and sub procedures you can start the application with a "Sub Main" in a class or a module to control all your forms.
Hope this helps. I've been coding in COBOL for 14 years and just recently started working with VB .NET because the company is going from a mainframe environment to a PC environment. I'm only on my 4th or 5th project and definitely consider myself a beginner. Hang in there... With .NET there is so much to learn that information overload can become a problem. Eventually the concepts will fall into place for you.
Kevin
|
|
|
|
|
A quick one,
thanks mate for your contribution. Will be trying it now. Will get back to you soon. Well, I thought of beginning programming using VB.NET because there seems to be a lot of useful knowledge to be gained from it.
Regards,
Ben
|
|
|
|
|
I want to create a Help file for an application, and is currently using Help Development Studio. The program expired a couple of days ago. Are there any other Help developing software (that is free) and is easy to use?
Another thing: How do I include the help.hlp file in the project? The user must click on a "Help" Menu Item, and the Help file must open!?!?!?
Desperate...
|
|
|
|