|
Switch/Cases accept only primitive data types, such as byte, short, char, int.
If you are checking for a string, a case becomes much more complicated to use.
It is better to use a Switch/Case when you are dealing with options, where you can associate each option with a Letter or Number.
If statements should be used when more complex comparisons are made, and can be grouped using the AND/OR keywords.
|
|
|
|
|
Hey Guys
I am trying to Bulk Insert a Text file into an SQL DB through VB6. I have never used this Object Model before so any help would be appreciated.
I have this code from MSDN but cant seem to implement it??
-----------------------------
'initialize Payroll table in DTS_UE db with bulk data
Dim objPackage As DTS.Package2
Dim objConnect As DTS.Connection2
Dim objStep As DTS.Step
Dim objTask As DTS.Task
Dim objBulkCopy As DTS.BulkInsertTask
On Error GoTo Handler
Set objPackage = New DTS.Package
'create database connection
Set objConnect = objPackage.Connections.New("SQLOLEDB.1")
With objConnect
.ID = 1
.DataSource = "(Local)"
.UseTrustedConnection = True
End With
objPackage.Connections.Add objConnect
'create step and task, specify data file and format
Set objStep = objPackage.Steps.New
Set objTask = objPackage.Tasks.New("DTSBulkInsertTask")
Set objBulkCopy = objTask.CustomTask
With objBulkCopy
.Name = "BulkInsTask"
.DataFile = "C:\Development\Bulk Insert\TEST.txt"
.ConnectionID = 1
.DestinationTableName = "BULK_INSERT_TEST..BI_Test"
.FieldTerminator = "-t"
.RowTerminator = "\n"
End With
'link step to task to package, run package
objStep.TaskName = objBulkCopy.Name
objStep.Name = "BulkInsStep"
With objPackage
.Steps.Add objStep
.Tasks.Add objTask
.FailOnError = True
.Execute
End With
|
|
|
|
|
hi all
i want to know how to load a form from another one by vb.net
by vb6 it was form2.visible=true
i tried it but it make error
Lost & Forgotten
|
|
|
|
|
Well you do as follows depending on scenario
just to show dialog
dim myform as new form2
myform.showdialog
|
|
|
|
|
dear
try to do this things
Me.hide()
Me.yourFormName.ShowDialog()
regards
Palestine Guy
|
|
|
|
|
Hello Everybody,
This is my first ActiveX control. I am desinging this control in VB6.0
I design 2 ActiveX Contrls One is Vertical Toolbar & second is Horizontal Toolbar.
I desing both of them. requirement of project is whenever user click on button of Vertical toolbar, Horizontal Toolbar will be created & displayed at position adjacent to clicked button.
(I think you got Problem Statement of project)
Now problem is whenever I am tying to create instance of my Horizontal Activex in Verical Activex control's Click event. Vb fired run time error on following SET statement
Public Withevents obj as HorizontalToolbar
Set obj = Controls.add("CntHori.TbrHorizontal","obj1")
Here CntHori is Lib name & TbrHorizontal is Control name.
Error name is ---> Obj not SET.
I try in this way assuming thta above code will create flyout Horizontal Toolbar on users form. Is there any different way to design flyout toolbar / control in VB.
Second Difficulty is when user move his form (during run time) how to get position of my placed Vertical Toolbar or user form's (Left,Top) so that i can move my flyout toolbar.
I think all of you get my difficulty.
If ther is any better way do this please tell me.
Your Suggetions Are most valueable for me. Deadline of project is 2 day only
Please Help Me.
|
|
|
|
|
Hi, i have a problem while clean the virus from my computer. My computer infect with the virus but I don't know the virus name. I try to access the registry but it seem that the virus has control the process of my PC. I want to view the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
but the registry is quit when I open it. Does any one know how to write the code in vb6 or vb.net to list the content of the registry into the listbox?
Need help urgent
Roath Kanel
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
You'll be muich better served by a virus scanner than wasting time writing this yourself. Chances are you won't find the virus being launched from the most obvious place in the registry to do so.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The most importance thing is checking the name of the virus. My computer at workplace are affect with the virus. I try to load anti-virus to scan it but an anti-virus is stop functionning. Everytime that I used to clean the virus is checking for the virus name and find the specific method to clean it (i read symantec documentation). I cannot use FixTool to clean it because fixtool is clean for one type of virus, so I need to check the name in the registry (i forgot to tell you, when i open registry editor it is close again). So that is why i need to check the content of the registry from the specific location (especially: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run) and find the name of the key parameter that virus drop, then I will know the name of the virus and the specific FixTool and method to clean it.
Roath Kanel
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Roath Kanel wrote:
So that is why i need to check the content of the registry from the specific location (especially: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run) and find the name of the key parameter that virus drop, then I will know the name of the virus and the specific FixTool and method to clean it.
Like I said, you finding the virus running from this key is very rare. Don't expect to find the name just sitting in the open like you expect. Anyway, here's the example of what you're looking for. This assumes there is a Button on your form and a ListView setup for Detail mode....Good Luck!
Imports Microsoft.Win32
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub btnReadRunKey_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReadRunKey.Click
Dim regKey As RegistryKey
Dim keyValue As String = "Software\\Microsoft\\Windows\\CurrentVersion\\Run"
regKey = Registry.LocalMachine.OpenSubKey(keyValue, False)
Dim regNames As String() = regKey.GetValueNames()
For Index As Integer = 0 To regNames.GetUpperBound(0)
Dim newItem As ListViewItem
newItem = ListView1.Items.Add(regNames(Index))
newItem.SubItems.Add(regKey.GetValue(regNames(Index), "*** NO VALUE ***"))
Next
regKey.Close()
End Sub
End Class
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hii all
i wish to study more on the net.socket
cause i want to do a application which enable a user to open a private server around a cyber cafe and allow his friends that is in the cafe to chat among each other
here is what i wish to learn
1. connecting the client and server via IP address or the computer name
2. enable file sending among client and servers
can anyone give me a hint or advise on how to do the above processes?
if a website is available, it would be better cause so far those that i found is not helping me
thank you very much for helping
Programmer in training
|
|
|
|
|
How do I format a cell in the datagrid if it meets a certain value? Like the conditional formatting feature of Microsoft Excel. Any ideas?
|
|
|
|
|
Hi,
I'm writing a Messaging app to be a GUI Net Send (like some of the articles), but want to have a history of messages received. I want to be able to catch a Message Window (from Net Send) if it appears, get the text from it, and then close it.
I've been told I need to use the windows APIs, like FindWindow, but I have no idea how to use them in .NET. That and I have no idea how to work out what the class name of the message window is.
Can anyone help?
|
|
|
|
|
Hi,
i am working on a project which involves writing from a windows form and webform in .NET to the system registry. Could anyone provide me information or sample code on how do i do that.
for example if i want to write something to the registry when i install a software on a system for the first time or every time the form loads, etc...
Could someone also provide me information on where do i find information abt system registry data and how to edit it or modify it.
Any sample code would be appreciated.
Thanks in advance.
cheers
dotnetdude
dotnetdude
|
|
|
|
|
When you load the form:
Use savesetting() to save the setting to the registry while you load the form.
Use getsetting() to get setting from the registry.
When installing the application:
If you are doing the setup project, there will be a choice whether the application need to write to registry or not.
Try to search for it in the .Net Documentation or search in the Object Browser.
Learning .NET
|
|
|
|
|
Create a setup project and use Registry Editor to create registry entries on the target machine during the installation.
For more info refer Deployment on MSdN
Bhaskara
|
|
|
|
|
Hello Everybody
I designing one activeX control, I want to get position(Left,Top) of user form, & position (Left,Top) of Activex within users form.
Please help me in this regard
|
|
|
|
|
hi
i have a simple client-server chat application which is usable on a single computer but not on two different computer
my lecturer says is because of the firewall but im not very sure about it
i want to know is there any way to connect it when the firewall is on?
currently im using port to connect it which is not working. i want try to connect it with computer name or IP but i dont know any coding about it
can you please give a link or a small coding sample that i can refer so that i understand more about the socket.net
thank you in advance
Gary
|
|
|
|
|
Just completed a conversion of an asp site to asp.net. I have an issue though, right now, we have alot of email etc with old links that link back to the asp files. I need a way to automatically redirect any .asp request to redirect to it's corresponding .aspx file. (page.asp to redirect automatically to page.aspx). I also need to include the params (if they exist) in the requesting query string. I've searched around and I've already changed to my appMappings in IIS to point to the ISAPI dll for .net (for .asp file extensions). By just doing that, the .asp request still goes down on a 404.
I've also tried to implement a 404.asp to auto redirect and that works fine except that it loses the query string parmameters after redirecting to the 404.asp.
Any ideas would be appreciated.
Ron
|
|
|
|
|
You question would be much better handled in the ASP.NET Forum...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok, I thought databinding in .NET would be oh so simple, turns out, I'm finding that I am writing the same code whether I Bind or Not! All of these stupid little examples on MessageBoards and MSDN suck! They never cover the REAL topic! How the heck do you save data to the DataView you've bound to, and then, once you re-populate your Data from the Database, how do you rebind your Controls? Or do you even need to!??
Well, here's what I am running into. First off, DataBinding works great! I can Bind and Navigate Records with ease. However, when I go to save, I run into problems since I am using DataRelations . I cannot use the BindingManagerBase of the Form to call "Me.BindingContext(Data).EndCurrentEdit" because then all my changes in Child Tables are GONE! Gone I tell you!!!
So, I am forced to use DataRowView variables when attempting to Save, which I connect to Me.BindingContext(Data).Current and Me.BindingContext(Data, DataMember).Current respectively and then call the "EndEdit" Method of those Rows. However, this causes an additional problem. Now, I have to write code which forces the values of my Controls into the Values of the DataRowView Variables (ex. dRow("Column") = TextBox1.Text)! So in other words...I just lost my DataBindings!???
What the @##$% is going on here!? Has anybody in the world actually got DataBinding to work with a DataSet that has multiple Child Relations?
|
|
|
|
|
my problem: I don't know how in VB6:
1) override DllRegisterServer in "ActiveX dll" project
2) explicitly assign GUIDs or registration script
In fact, the question is: are there in VB6 some patterns
or best practices to implement Plug-in's? (e.g. plug-in
category in Registry and interface to implement)?.. If
the common practice is the same, how to implement it by
means of VB?
Thanks,
)
|
|
|
|
|
A.Obraztsov wrote:
1) override DllRegisterServer in "ActiveX dll" project
2) explicitly assign GUIDs or registration script
You can't do either of these things in VB6. You can if you write your ActiveX .DLL in C++.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I Know ( I have 4 years experience programming ATL
and VC++. But the situation is following: I need to reengineer some set of components, implemented
in VB6, that I see to be easy implemented via one major
component and a set of plug-ins. I see that, but I cannot do that! I can rewrite the code in VC++, but it will take time and is not a fair solution. Also, I won't do that alone: I have only VB and Delphi developers.
I thought in VB might be some patterns to do that, avoiding
change of programming language and environment!
In fact, I am interresting in some way to do that, not
exactly by means of methods mentioned above. If I cannot
explicitly assign GUID, I could set "compatibilty" with
previous versions of my component etc, e.g. inherited
from MSIDL-compiled TLB.
Thanks for your answer,
A.Obraztsov
|
|
|
|
|
Hello,
I would like to know wether there is a way to align a toolbar control to the right side of a VB .NET form, istead of to the left side as default.
Thanks,
Tom Rahav.
|
|
|
|