|
This isn't as "generic" an operation as your question implies.
You have to write the code to open a text file, and read it, line-by-line. OK. This is pretty simple.
Hears the simple, but oh-so-tedious part. Each one of those lines has to be parsed up into the various fields that your require and put into variables to validate and hold those values. Once you have to data in those variable, you would probably run a stored procedure on teh SQL server, passing in those variables, to add the new data to whatever tables you need it to.
Back to very simple again, when you done reading the file, close it.
Writing this for you is out of the question. That's not how this forum works. If you want it written for you, go to www.rentacoder.com and spend way-too-much money to have someone do it for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm writing a simple Windows App with one form - Form1.
I want to automatically close this form upon the execution of some code - not a click event or any other user-initiated event. I need some ideas. Once control has passed from the code to the form (Sub New() and InitiateComponent), I'm stuck.
I've tried using Form.Close, and MyBase.Close and Application.Exit. It may be that I'm placing these in the wrong sequence.
|
|
|
|
|
Perhaps I'm not understanding your question, but Me.Close worked just fine. Created a new windows application, dropped one button on the form:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e _
As System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
Ran it, clicked the button, program ended. I think in .NET your application is active as long as there is any form loaded, even if you close the "main" form.
-- modified at 11:27 Tuesday 11th October, 2005
Nope, just checked, if you close the main form the program ends even with another form loaded.
|
|
|
|
|
I take it your trying to close the form from its own Load event? You can't. A form cannot close itself from inside its own OnLoad event.
If you're doing some processing to determine if the form needs to be show, do it before you even instantiate the form. The form should be responsible for all of the input and processing of certain data. It should not be responsible for determining if it should be shown at all. This is business logic that should not be in the User Interface layer.
If you're trying to show status information on a form during processing, consider rewriting this code into it's own class that exposes events that a UI layer can use and show any which way it wants.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
dim frm1 as new form1
frm1.topmost = true
frm1.show
'process
'process
'process
'process
frm1.close
or
create a seperate sub from the from-load event
then call the sub
like so
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call CLOSEME()
End Sub
Sub closeme()
Me.Close()
End Sub
hope it works
Marvin N. Guerrero
- Taje Kage_bunshinNunJutsU
|
|
|
|
|
dont mind can u pas the same to me if u get the rep.
|
|
|
|
|
s, i got some idea.
y cant u v try Timer controls in this regard.
i think it vil help us a lot.
|
|
|
|
|
Hi,
i would like faced a problem which is, There is one datatable contains records. There is one thread which downloads the files depending upon this data table. Here oen thread downloads a file one at a time. i want to downloads 2 files at a time. how it is possible. help me with code
Thanks & Regards
Srinivas
|
|
|
|
|
in vb.net
dim a,b,c as integer
b=10
a=b=5
msgbox a 'output is 1 why because of boolean or not
himanshu
|
|
|
|
|
I just cut and pasted your code into a new project and the Message Box came up with 0, changing your code to:
<br />
Dim a, b, c As Integer<br />
b = 10<br />
a = b = 5<br />
MsgBox(CBool(a))<br />
Returns False , which I would expect.
Cheers
Tom
|
|
|
|
|
sure it is boolean, you can define a as string to have a try. obvious you give a the value b=5 .
I am Entry level person
|
|
|
|
|
he he he.
just curious.
what are you trying to do?
I tried the snippet and i got an output of 0
given b = 10
.... b = 5 is false
... cint(false) is 0
... cint(true) is -1
anyway
try typing
Option Strict On
at the top of your code and youll get "Strict Option On disallows implicit conversion from "Boolean" to "Integer""
just said it in case
Marvin N. Guerrero
- Taje Kage_bunshinNunJutsU
|
|
|
|
|
can you tell me how to make a message or a text that call from a window service , code in VB.net
|
|
|
|
|
You're service has to be tagged to work with the desktop. Go into the Services manager, select your service and get Properties on it. Then click on the Logon tab and check the box labeled "Allow service to interact with desktop".
After that, you're service can put up dialog windows and MessageBoxes all you want.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I do like you say , with log on as Local System and check to "Allow service to interact with desktop" , but it do not show message ,
Why it be show , tell me more please .
Thanks
|
|
|
|
|
What are you using to show the "message"?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hey, as a school assignment I have to write a program for a Rent-a-car company and I am having trouble writing the pseudocode for it.
Firstly a login screen will be displayed, then once the login has been successful it will take the user to the main menu which will then display 3 options:
1) View vehicle database
2) View customer database
3) Quick Rent a vehicle
So far i have been able to write the following pseudocode: (frm = form)
Read LOGIN
If username = "Torr" AND password = "hurtz"
THEN Unload Loginfrm
Show MainMenufrm
I dont know how to write the next bit that allows the user to choose one of the options of the main menu, could anyone please help?
Thanks for your time
|
|
|
|
|
Pseudocode (or p-code) is simply writing down the logic of the program in a way that is readable by humans but is not necessarily valid computer code.
In this case you need to write the logic of what you want to achieve in English which can then help you to translate this to VB, C#, C++ or whatever computer language in which you are writing.
I do this all the time (well mostly ) but especially when I need to specify some logic to a junior programmer without actually writing any code myself.
Everyone's style of writing p-code will be different so don't take what I write here as gospel - you will soon find out what does and does not suit you.
You are on the right track with the login form, but may I suggest this:
[Main Program]
initialize any global variables
display Loginfrm
[Loginfrm]
When the Login button is pressed
begin
read the username and password
if the userid and password are valid then
hide Loginfrm
display MainMenufrm
endif
end
when the "Exit" button is pressed
begin
End program
end
[MainMenufrm]
when the "View Vehicle Database" button is pressed
begin
hide MainMenufrm
display ViewVehiclefrm
end
when the "View Customer Database" button is pressed
begin
hide MainMenufrm
display ViewCustomerfrm
end
when the "Quick Rent" button is pressed
begin
hide MainMenufrm
display QuickRentfrm
end
when the "Exit" button is pressed
begin
hide MainMenufrm
display Loginfrm
end
As you can see some of the detail is starting to emerge and points where additional detail is required are being identified. Writing p-code is an iterative process and you can continue down this path to the 'n'th degree. In the above example p-code may need to be written for the QuickRentfrm , ViewCustomerfrm and the validation logic around the userid and password entry, etc. to tease out the details of their operation too.
Best of luck with the assignment.
...Steve
|
|
|
|
|
Thanks alot for your help
|
|
|
|
|
Not a programmer, so there's probably an easy answer to this one. Trying to write some code to automate a process by starting an external program in vb.net, using sendkeys to perform some tasks, and close. The problem is that when I start the program using shell, or process.start(), it starts with no registry info. It starts the program like a brand-new install(wanting user info and software-key info). I've experimented with using runas from the command line, and it does the same thing no matter which user I run it from... however, if I run it from the command line by just typing the path&file name, then it loads normally.
Been searching for a couple days now on the web for an answer to this... in my sample I can open notepad and send it stuff with no problem--and I think the rest can be figured out if I can just get the program to run as normal, instead of starting as a new install.
Thanks for any help.
|
|
|
|
|
As I suspected, it was something silly. To answer my own question just for the benefit of other novices like myself, this code does the trick:
Dim myProcess As Process = New Process
Dim pi As New System.Diagnostics.ProcessStartInfo
pi.FileName = "appname.exe"
'I didn't use any arguments--but they go here
'pi.Arguments = "c:\first.doc"
pi.WorkingDirectory = "c:\program files\appsubfolder\app\"
pi.WindowStyle = ProcessWindowStyle.Maximized
myProcess.Start(pi)
Setting the working directory fixed it. From there, it appears that sendkeys.sendwait is going to perform the automation items the way I need it to. Thanks.
|
|
|
|
|
Hello everybody, I am looking for a tic tac toe code sample in vb.net using arrays in a windows application. It also should allow two human players and use integer arrays. If you have the code I'd appreciate if you send it to me, thanks in advance.
|
|
|
|
|
|
can any one tell how to pass the 2 url in a funcion say i have a function which check the url is valid r not thro http respnse if i give 2 url together i need my application to check the url 1 by 1 this is the code snippet
Public Function checkurl(ByVal url As String) As String
Dim req As System.Net.HttpWebRequest
Dim res As System.Net.HttpWebResponse
Dim r As System.IO.StreamReader
Dim ex As Exception 'error exeption holder
Dim pge As String 'page holder
Dim title As String
Dim strreturnstring As String
url = "http://www.yahoo.com"
' i need to pass 2 url like "http://www.sg/" and "http://www.yahoo.com/"
Try
'display request url
req = req.Create(url)
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)"
req.AllowAutoRedirect = True
'get page
res = req.GetResponse()
r = New System.IO.StreamReader(res.GetResponseStream())
'pge = r.ReadToEnd
r.Close()
res.Close()
strError = "OK"
status = "True"
'Convention is First Value is the Status and Second value is Errmsg
strreturnstring = status & "~" & strError
Return strreturnstring
Catch ex
status = "False"
strError = ex.Message
strreturnstring = status & "~" & strError
Return strreturnstring
End Try
End Function
any suggestion pls it urgent
Regards
ybasha
|
|
|
|
|
Hello..
I just need to know..I already can read the IC number name from the MyKAD(smart card).
The result that I get is below:
ANG SWEE LEONG 711223105477
The question is, how am I going to remove the "[]" symbol in that data?
I use the source code below to print out the data
For Counter = LBound(abyRecvBuffer3) To UBound(abyRecvBuffer3) Step 1
Result = Result & Chr(abyRecvBuffer3(Counter))
Next Counter
ReadName = Result
The data that I get is correct, but the problem is the symbol "[]" appear at the website, so I cannot get the catual data.
Notes: The data is in Hexa format, I convert it to Char.
Izyani-
|
|
|
|