|
|
good afternoon.
i'm currently using vb.net and sql server.
i just want to ask advice or guidance on how to save microsoft office documents(.doc,.xls,.vsd,.ppt), text files, and html documents, etc. in the database and if i open one of the files, example is a word document, the document will open in the same format as in the ms word.
what appropriate tools should i use? i'm thinking of the saving pictures in blob format but i don't if it is applicable...
thanks in advance...
|
|
|
|
|
Hi,
If u r thinking to save Files in dB than better u set Column's datatype as image........
u can easily convert the file into array of bytes as
Dim reader As New FileStream(strFileName, FileAccess.ReadWrite)
ReDim pi_arrbyteFiles(reader.Length - 1)
reader.Read(pi_arrbyteFiles, 0, pi_arrbyteFiles.Length)
reader.Close()
When u want so save the file back on the m/c u can call
Dim strWrites As FileStream
If File.Exists(strFileName) Then
File.Delete(sfdFile.FileName)
End If
strWrites = File.Create(strFileName)
strWrites.Write(pi_arrbyteFiles, 0, arrbyteFiles.Length - 1)
strWrites.Close()
End If
Regards,
Ritesh
|
|
|
|
|
good morning...
thank you very much for the advice...
more power...
|
|
|
|
|
|
good morning...
thank you for sharing me the site.....
|
|
|
|
|
Hi, can any one tell me how to prevent the right click on the combobox or textbox??? I can prevent the user from typing by using keypress event, but I could not prevent the user from right click and paste the value to override my value in the combobox or text box.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Quick and easy TextBox1.ContextMenu = New ContextMenu , otherwise you will have to inherit from the TextBox and Override the WndProc method. To intercept the paste:
Public Class MyTextBox
Inherits System.Windows.Forms.TextBox
Protected Overrides Sub WndProc(ByRef m As Message)
'Call base method if not the paste message
If m.Msg <> &H302 Then MyBase.WndProc(m)
End Sub
End Class Hope this helps
Tom
|
|
|
|
|
|
I need to pass a string value into an window form app where the string will be used to validate wheather the form should or should not be shown/loaded base on a hardcode ID. How should i do it?
ANd what command should i type if i wish to test run in Start->Run
|
|
|
|
|
You don't need to do anythign special to pass parameter to the exe.. just call like this:
myExe param1, param2, param3
inside your exe, your must look for command line parameters and take appropriate action.
----------------------------------------------------------------------
T Manjaly
My C# Tutorials articles www.dotnetspider.com
|
|
|
|
|
i see okiee thankzz for the tips
|
|
|
|
|
Hello ,
i know this seems crazy to ask ,but better ask then assume, i have a project to finish and programing it's not for me , can someone help me with this?
here is what i need to get done:
that the form contains multiple group boxes, DateTime Picker controls, and a NumericUpDown control.
The cost of a hotel room is based on the following rules:
• The base rate for the room depends on the room type. Standard = 84.50, Deluxe = 104.50, and Suite = 154.50.
• If the number of guests is greater than 2, a $10.00 charge is imposed on each additional guest per night.
• An additional rollaway bed costs $5.00 per night.
• Declare constants as necessary to store the various rates.
• Using the rules described in the previous list, write the code to calculate the cost of the hotel room and display the output. Format all of the output. Make the Calculate button the accept button.
• The Clear button should clear all of the output values, set the arrival and checkout date to the current date, and set the room type to standard. Remove the check from the Additional Rollaway Bed check box and, finally, set the default number of guests to 2.
• and the code for the Exit button to exit the solution
|
|
|
|
|
bdobruna wrote:
programing, it's not for me. Can someone help me with this?
No, not without a personality transplant.
Why does everyone expect help with code when all they do is copy and paste the homework assignment? You're going to have to start the code yourself. If you have specific questions on the code or language, we'll help with that. We won't write the project for you.
|
|
|
|
|
I didnt ask you to do the project for me i only asked for some help to start just like the friend below gave me an idea, but thank you anyway.
Benny
|
|
|
|
|
The list of tasks you must do is nicely broken down already so it should be easy to go through this and complete each item and check it off your list.
So, create your form with the various controls on it. Give the controls sensible names (don't just keep the defaults like TextBox1 or Label1 and so on).
You can double click on a control in the designer to get the default behaviour. If you double-click a button Visual Studio will create a Click event handler for you. (If you have given your controls sensible names the event handlers will get sensible names).
The creation of constants[^] is a trivial thing. Personally, I'd store values like this in the database (Sales and Marketing departments like to change things, give special deals to get people in the door and so on) - but since this is not a real world application, constants will serve just as well.
The maths to discover the rate is simple high school maths: (numberOfNights*roomRate)+(numberOfNights*extraGuestCharge*extraGuests)+(numberOfNights*rollawayBedCharge*numRollAwayBeds)
So, now you should have a starting point. Get going, and if you get stuck on doing something get back to us and we can help you on specific items.
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
|
|
|
|
|
What a terrific answer, I would have loved somebody to show me how to do homework this well when I were a lad
I would have been all for an answer like this had the O.P shown some enthusiasm, but really what we got was
have a project to finish and programing it's not for me (readas: I cant be bothered to look back in my textbook about how to do each of these small tasks)
Oh well, Im sure he/she can get this homework done now and get onto something more fun for him/her
|
|
|
|
|
I gave you 5 to counter that 1 you got.
I believe that the O.P only asked for code instead of help with the project, which in my opinion may only take 1 to 2 days even for a starter.
The list he/she gave is nicely written unlike the request he made, so I'm assuming he/she just did a copy and paste from the assignment notes.
Reminds me of a friend who always asked for help only when an assignment is due that day. He asked for help in 'explaining' on how to do a project but in the end I did most of the work since he knew next to nothing.
Edbert P.
Sydney, Australia.
|
|
|
|
|
I'm lost...I have written database management code in C++.net for adding, updating, retriveing entries, what i am wanting to do is, and this is where i'm lost, be able to call the proper code with a button click in VB.NET. Is this possible and if so how is it done. I have done much searching about this and even looked in Books that I have and cannot seem to find the answer. Any help would appreciated.
|
|
|
|
|
You can make it a separate assembly and add a reference to it from your vb.net code. You should be able to call the methods in your C++.NET assembly this way.
----------------------------------------------------------------------
T Manjaly
My C# Tutorials articles www.dotnetspider.com
|
|
|
|
|
I am developing a windows service in VB .NET. I currently am using a START button on a windows form (separate application) to start the service. I would like to avoid having a separate application and, instead, have the service automatically start at installation.
Does anyone know how I might accomplish this?
Thanks for your time.
|
|
|
|
|
hi my dear friend,
always
Try avoiding a user interface, inputs and message boxes in the service application or for starting the service.
To make your service to start Automatically during the start up of windows
in the serviceinstaller
Open the service.vb design window, right click on it and select Add Installer option, which will add an installer project (called ProjectInstaller.vb) with two controls -- ServiceProcessInstaller1 and ServiceInstaller1 -- to our existing project.
Open ProjectInstaller.vb, select the ServiceInstaller1 control, and open the property window.
Change the StartType property to automatic if you want to start the service automatically during the OS Start Up.
HAPPY PROGRAMMING!
With regards,
Barathan.K
Barathan.K
|
|
|
|
|
Thanks for your reply.
Actually, I do have the service automatically starting during the OS start-up using the method you described. What I want to do is have the service automatically started right after installation (without requiring a reboot).
I was eventually able to accomplish this by putting the following code in the ProjectInstaller.vb file. The program "MyApp" is a console application that starts, stops, pauses, etc. the service using various command parameters (in this case, "/start,MyService").
'Auto-start the service after installation.
Dim psInfo As New System.Diagnostics.ProcessStartInfo("C:\Program Files\MyApp.exe", "/start,MyService")
psInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden
Dim myProcess As Process = System.Diagnostics.Process.Start(psInfo)
Thanks,
Todd_S
|
|
|
|
|
Hello,
I am using Visual Studio .Net developing for handhelds. I am coding in VB.
I have bound the fields on the form back to the datatables in the dataset. What I am doing is changing a value in a field and then I want to save the changes back to the database. I am using the dataset.HasChanges() to see if any changes have been made. When I perform the check it doesn't recognize that the field value has been changed and therefore doesn't update the data back to the database. I have added a messagebox to display the value of the field changed and it is displaying the modified value. Can anyone help to explain why the changes aren't being recognized and what I need to do to get them to be so?
Note: If I select a different row of data and then attempt to save the information it works fine. I have tried using me.bindingcontext("datatable").position +=1 as a suggestion from someone, but it causes an error.
Thanks,
Carey
|
|
|
|
|
I know this may seem easy, but I just can't seem to find an easy way to do it.
I have a string set to a fixed length of 256 that is part of a user defined type consisting of a structure of various data types. In the 256 fixed length string I will often write a message to it, which is ok. But at other times I wish to write to the last byte of the fixed length string the value '1' to indicate something else. Therefore what is the best way to handle this. I have looked at the Replace function to start at position 256 and replace the " " with the value 1, but when I look at the fixed length string after this has been done the value '1' is at the beginning of the string and not at the end. I then used Space(255) and combined this with the string to move the one to the last byte. But then I want to overlay onto the fixed length string a message so that I get "message text ... 1". Is there a more simpler way of changing the 256th byte of the fixed length string, i.e. teststring[256] = "1".
|
|
|
|