|
"Final" year? How many years did you have this teacher?
Your numbers aren't; they are text. If you want to calculate, use numbers. Also, don't concatenate strings like that, I would wipe your database on my first test-run of your application.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
|
hey
i'm working on a notepad project
and i want to open .txt files with my app
it worked
BUT
when i open a file ,modify it and save... save only NOT save as
it opens save as file
i want to modify the opened file
here is the code i'm using
Shared Sub DoubleClickFile(Textbox As TextBox)
If System.Environment.GetCommandLineArgs().Length > 1 Then
Dim i As Integer
For i = 1 To System.Environment.GetCommandLineArgs().Length - 1
Dim zReader As StreamReader
zReader = New StreamReader(System.Environment.GetCommandLineArgs(i), True)
Textbox.Text = zReader.ReadToEnd
Next
Else
End If
End Sub
|
|
|
|
|
Where is the code that saves the modified file?
|
|
|
|
|
Backgroud: I'm trying to automate the printing of PDF files.
I found that by invoking
acrord32.exe /N /T pdfFile printerName on the command line you can print PDFs silently. Great.
I'm trying to automate this in VB via
Dim p As Process = New Process()
Dim pi As ProcessStartInfo = New ProcessStartInfo()
Dim command As String = Chr(34) & "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\acrord32.exe" & Chr(34) & " /N /T "
Try
pi.Arguments = String.Format("{0} {1} {2} {3}{4}{5}", " /C ", command, sFilename, Chr(34), sPrinter, Chr(34))
pi.UseShellExecute = False
pi.RedirectStandardError = True
pi.RedirectStandardOutput = True
pi.CreateNoWindow = True
pi.WindowStyle = ProcessWindowStyle.Normal
pi.FileName = "cmd.exe"
p.StartInfo = pi
p.Start()
Do Until p.HasExited : Loop
outp = p.StandardOutput.ReadToEnd
Debug.Print(outp)
outp = p.StandardError.ReadToEnd
Debug.Print(outp)
Catch ex As Exception
Debug.Print(ex.Message)
End Try
The error message I get from StdErr is Quote: 'C:\Program' is not recognized as an internal or external command, operable program or batch file.
I've tried putting quotes around the command string, but it just doesn't work.
Turning to the community for guidance.
|
|
|
|
|
You have to separate the command line options from the command you're trying to execute.
For your "filename", you've got:
"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\acrord32.exe" /N /T
That doesn't work.
Your filename and arguments must be specified separately:
Dim command As String = """C:\Program Files (x86)\Adobe\Reader 11.0\Reader\acrord32.exe"""
Dim arguments As String = String.Format("/n /t ""{0}"" ""{1}"" ""{2}"" ""{3}""", pdfFilePath, printerName, driverName, portName)
Dim process As New Process
Dim pi As New ProcessStartInfo
pi.Filename = command
pi.Arguments = arguments
process.StartInfo = pi
process.Start
Yes, the double quotes are there for a reason. It's shorter to type "" than it is to type Chr$(34) & .
|
|
|
|
|
Your suggestion worked perfectly. I was over-thinking the problem. I was trying to run cmd.exe and pass the acrord32.exe as a parameter.
Your solution of running acrord32.exe directly worked.
Thank you.
|
|
|
|
|
Hello,
I am stumped by this.
csng("1422.843197465627") returns
1422.84314
and NOT 1422.8432 or even 1422.84319
even CType( "1422.843197465627", Single) also return the same value.
Can somebody explain this to me?
|
|
|
|
|
Are you sure? On my computer, it returns 1422.843 , not .84314 .
You're converting to a single-precision floating point number[^]. The documentation is quite clear: Quote: A Single value has up to 7 decimal digits of precision, although a maximum of 9 digits is maintained internally.
If you want more precision, use a double precision floating point number[^] instead, which supports up to 17 digits.
But be aware that neither type can guarantee to precisely represent every decimal number you throw at it. For example, 0.1 doesn't have a precise binary representation.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
I've created a custom tooltip control using a UserControl as the base. When dragging the
control from the toolbox to the form it displays the control (of course) but I want it to
be added like a ToolTip when it is dragged to the form; as an object displayed below the form
in the designer. I've been searching for an answer but I'm not even sure what question to
search for. Can someone help?
Thanks
|
|
|
|
|
Inheriting from UserControl was the wrong route to take. In order for it to show up below the form in the designer, you inherit from Component, not UserControl.
ToolTip is not a normal control. It's an extender that modifies other controls. It adds functionality to anything that inherits from System.Windows.Forms.Control.
The standard ToolTip class inherits from Component and implements the IExtenderProvider interface. You can see the source for ToolTip here[^].
|
|
|
|
|
Thanks a lot for the information and link. I will try that road instead.
|
|
|
|
|
My teacher gave us an assignment to link two forms together where one form is an admin form where u can put things and delete things together and another form is an user form where they can only view it. My question is I want to do a video input format and I can only embed my videos on form 1 but it wont show on form 2 can anyone please help.
|
|
|
|
|
Tell your teacher that forms aren't linked, but created and opened.
Lost wrote: My question is I want to do a video input format and I can only embed my videos on form 1 but it wont show on form 2 can anyone please help. Show us your code
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hello !
I'm using entity framework 6 and vb.net 2017.
I have a situation where I read some data from database :
Dim lst as ienumerable(of Mytable1)
lst=context.mytable1.where(Function(t2) t2.nr1=1).Tolist After that , I've made some modifications on some items on the collection , and after that i want to remove from the collection the items that have vl1=0. (But of course I want to do that only on local data that is read before from database and nothing will be saved on database )
How can I do that ?
|
|
|
|
|
|
I'm sorry to bug people about this but I'm still having a slight problem with a Database programming question with Visual Basic 6/Net. I took the advice of someone else on this message board (thanks) about instead of using a combo box as a control but use a simple textbox/command button to control a database pointer in a database program that controls what table to use within the database. Here is the following code I'm using now...
Private Sub cmdSelectedLeagueGameBack_Click()
Dim DataPointerIndicator As Integer
Dim DataIndexNumber As Integer
DataPointerIndicator = DataPointerIndicator - 1
If DataPointerIndicator <= 0 Then DataPointerIndicator = 1
Select Case DataPointerIndicator
Case Is = 0: DataIndexNumber = 0
Case Is = 1: DataIndexNumber = 1
Case Is = 2: DataIndexNumber = 2
End Select
Data1.RecordSource = DataIndexNumber
Text1.Text = Data1.RecordSource
End Sub
The problem I'm having is that I can't figure out how to use the "DataIndexNumber" varible to connect to the "Text1.Text = Data1.RecordSource" so that I can display each table within the Connected Database. The table display properly within the Text1 Object, but I have no idea how to make a "Pointer" within the Database and how to control the "Pointer".
Any help would be most appreciated.
|
|
|
|
|
You use the index value to select the appropriate table. But a much easier method would be a ListBox with the table names, so the user could select the name, and you then have the exact value necessary.
|
|
|
|
|
Yes, I was trying to use an varible to "control" a pointer (which I haven't figured out how to create yet) much like the Index value you described but I can't seem to come up with anything with the previous code. I'm kinda stumped.
A listbox sounds like a good idea, but how do I display the individual tables within the Listbox? Do you have an example I could use for this?
|
|
|
|
|
I am not sure exactly what you are trying to do. Are you trying to display the content of the tables, or just their names? If the former then there are plenty of articles that explain how to bind between different view types and a database. If the latter then you just need to get the names from the database and add them one by one to the listview, or use simple databinding.
|
|
|
|
|
What I'm trying to do is build a simple utility that inputs data from a sporting event into individual tables within a database. Each table represents a sporting event with recorded stats. I have linked the database to the utility porperly with the code I listed before, but I can't seem to figure out how to build a pointer to input the data from each game into a particular table. Switching from table to table in the database is inportant in this utility, but I just can't figure out how to control the pointer in the database with a simple command button and a textbox to display the selected table.
any info would be most appreciated.
|
|
|
|
|
What you describe indicates a terrible database design - changing tables for different events/sports is a disaster (which you are finding)
Take a look at this database design[^] and consider starting from scratch with a better data structure.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Terrible Database Design? Whats wrong changing from one table to another?
|
|
|
|
|
Did you look at the design patterns in the link?
What happens when you have a new event/sport, you have to build another table, add code to service the table, EVERY time there is a new requirement.
If you designed your database properly you would have a EventType table with a foreign key to an event table. To add a new event you would create a new RECORD in the EventType table. The user can do this and you don't need to create a new table.
Look at the templates and read up on database design, you cannot become a LOB developer without a reasonable knowledge of database design.
Never underestimate the power of human stupidity
RAH
|
|
|
|