|
You would haev to load the icons/images into Bitmap object, then paint each Bitmap onto the PictureBox using it's Graphics.DrawImage and Graphics.DrawIcon methods.
OLE is a whole other matter. You can't paint onto OLE. Are you trying to embed these images into a Word document or what? You'll have to be more specific as to what your trying to do.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I am trying to pass parameter value to ODBCCommand object.
but it is not assigning, the null value is gets stored. i m using following code,
Private Sub cmdsave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdsave.Click
Dim command As New OdbcCommand
Dim str As String
Dim photo() As Byte = GetPhoto(txtpath.Text)
str= insert into emp(id, name, photo) values (1,@name,@photo)
command = New OdbcCommand(str, con.cn) ' con.cn is connection object
command.Parameters.Add("@name", OdbcType.VarChar, 20).Value = "sagar"
command.Parameters.Add("@photo", OdbcType.Image, photo.Length).Value = photo
command.ExecuteNonQuery()
msgbox "saved"
End Sub
Public Shared Function GetPhoto(ByVal filePath As String) As Byte()
Dim fs As FileStream = New FileStream(filePath, FileMode.Open, FileAccess.Read)
Dim br As BinaryReader = New BinaryReader(fs)
Dim photo As Byte() = br.ReadBytes(fs.Length)
br.Close()
fs.Close()
Return photo
End Function
Please can anyone help me?
Regards
Programmer2004
|
|
|
|
|
Each parameter needs to have an assigned direction (Input in this case). So the syntax is as shown below. You can't do it in one line.
Dim param1 As New OdbcParameter("@name", OdbcType.VarChar, 20)
param1.Direction = ParameterDirection.Input
param1.Value = "sagar"
command.Parameters.Add(param1)
|
|
|
|
|
Hi,
Thanks, I solved my problem by using ,
Dim param1 As New OdbcParameter("@name", OdbcType.VarChar, 20)
param1.Direction = ParameterDirection.Input param1.Value = "sagar"
command.Parameters.Add(param1)
Regards
Prpgrammer2004
|
|
|
|
|
I have a window service (Project1) that call a form. The form i called is "Form1". If the form1 has load the form, and then it will call the Form2. The Form1 and form2 is in one project, called Project2. When I run the Project2, the form1 and form2 shows okay. No error on it. There are no error messsage at all. Problem is when i call form1 from the windows service, it will call form2. The Form2 won't display cause i set it minimized, but it has a notify icon, once i click the notify icon, it will show me the the form.
1. When I click it, the problem comes is System.Windows.Form: '0' is not a valid for 'value'. 'value' should be between 'minimum' and 'maximum'
the Form2 is default i set the ShowInTaskBar to False, WindowState to Minimized.
When I click the notify icon, I set ShowinTaskBAr to true, and WindowState to Normal.
The ShowinTaskBar works fine, but the WindowState doesn't work. How can be like this?
Error message is System.Windows.Form: '0' is not a valid for 'value'. 'value' should be between 'minimum' and 'maximum'
If we just click the error message, then we click again the notify icon, it will show the form control bar, without showing the body of the form. We need to resize it in order to see the body of the form. The datagrid in the first tabpage will have data, but the datagrid in second and third tabpage will have no data. This is also the error.
As I said before, there are no problems running project2 manually, but problem come when i call it from windows service(Project1). The tabpage also got no problems. I've set the service to interact to desktop already.
Anyone can help me get out from this problem?
Thanks in advance
Learning .NET
|
|
|
|
|
Sorry disturd sir again. I need sir guidances.
Brief project description:
A server which can control the external hardware through parallel port. The external hardware is just the LEDs to illustrate the on/off operation. There are some sensors connected too.
Read Opeartion: from sensors
Write Operation: to LEDs
I decide to use VB.net as my interface. For webpages, I decide to use asp.net and html. When I study the asp.net, I discover that inside the asp.net, there allow vb.net scripts. So, I plan to incorperate the vb.net into asp.net. Is there possible? or sir have any suggestions?
I do use any microcontroller because I not familiar with those programming. I just decide to use parallel port to direct connect the hardware to the server. Is there all right?
Can sir give me your e-mail address so that we can make a friend or make further communication ?
I hope sir can guide me because my project's due date is approarching, thank you very much !
|
|
|
|
|
First, you can' use the WriteFile and ReadFile methods you found before. This will not give the control you need to control the LEDS and read from the sensors. You MUST use a driver like the one I posted before (http://www.logix4u.com[^]). You'll be using that so you can get I/O port level control of the parallel port.
Second, the VB.NET scripts are sued to generate client-side HTML. That's all ASP.NET does is generate HTML. It executes NOTHING on the client side. Web servers are stateless machines. You'll have to write a component that will control the parallel port/microcontroller hardware that maintains state information. This will be running as either a service on the webserver or as a seperate .EXE. It has to expose an interface that ASP.NET can use to get state information and methods that can be used to receive commands from the ASP.NET code. This is because when ASP.NET generates a page for you to view, all state information is forgotten.
Third, your projects due date is approaching? I hope your not in a hurry to get this done. It doesn't sound like you've written a single line of code for ASP.NET or have much experience in VB.NET??? You've got alot of research and design work to do...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
I'm looking to build a toolbar JUST LIKE the google bar in IE explorer and have it run in IE like google's.
Can anyone help point me in the right direction to create the items and to gain control of the page contents - kinda like googles highlight feature - it needs access to the contents.
I would appreciate any assistance.
Thank You!
|
|
|
|
|
You'll have to create a Tool Band object to create a toolbar like Google did. This is not easily accomplished because you have a lot of COM Interop work to get this to work.
Lucky for you, it's already been covered in this[^] article here on CodeProject.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello,
I'm having some problems saving the state of a textbox in VB.Net. Here's the scenario, I have a textbox with it's properties set to Multiline to True, and several lines of text in the Lines properties, so the string array has 5 lines. These properties to the textbox were set with the editor not prgrammically.
When the application is running I want to be able to add or delete from the textbox, and make the changes permanent. So, when I close the application and come back I want the modified values to be shown inside the textbox.
Any ideas would be helpful. Thanks!
P.S. No database is being used.
|
|
|
|
|
You have to save the information to a file yourself. The IDE saves the property values you set in the code your writing. See the Windows Forms Designer generated code Region to see what I'm talking about.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks a million I'll take a look at the generated code.
lxhan
|
|
|
|
|
You could also try saving the textbox.text property by making it a dynamic property. That way it is saved automatically. The text is saved in the app.config of your application.
|
|
|
|
|
Thanks a lot I'll give it a shot.
lxhan
|
|
|
|
|
I been playing with the dynamic property of the textbox to see if it save the new entered text in the app.config file. It only save the hard code values that were defined in the IDE at design time.
I set the dynamic property of the textbox field. Did I forget to set anything else or do I need to write the logic in the source code?
lxhan
|
|
|
|
|
I forgot to mention. You have to write code to save the text when you exit. It's just XML parsing and saving. What it does provide however is automatic reading of that property when you run it again.
|
|
|
|
|
|
I have a piece of code which lists the available SQL servers(or any server for that fact) with in a given domain. The problem is, this requires me to enter the domain name manually. Can anybody please provide me with the code or point me in the right direction to find a solution; which obtains the current users domain name.
|
|
|
|
|
Have you checked out the UserDomainName property of the Environment class?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I am trying to use the cdlOpen to open text files but when I click on open the txt file i have selected does not open.
Below is the code i am using
Private Sub mnuOpen_Click()
cdlOpen.Filter = "Text (*.txt)|*.txt"
cdlOpen.ShowOpen
End Sub
|
|
|
|
|
The common dialog control is only there for the user to SELECT a file. It does not actually open the file. It is up to you, the developer to supply code to actually open the file and do something useful. The selected file's filename is returned in the FileName property of the Commondialog Control.
|
|
|
|
|
Hi, thanks for ur reply. But, I found an information as below,
" To write data to LPT1, use the following code:
Success = WriteFile(hParallelPort, Buffer, Buffer.Length, BytesWritten, IntPtr.Zero)"
In this statement, the author didn't mention about the read operation. Do sir know it?
As sir reply,
is there compatible to implement in visual basic.net?
The dll file can use in vb.net?
All the code in that site can use in vb.net?
Thanks for your help, thank you very much!!!
|
|
|
|
|
The line you found is written in VB.NET. It's not a native function of VB.NET or the .NET Framework. It's actually a call into the Win32 API. You'll also need to use the API function CreateFile to get a valid handle to the parallel port. The API function ReadFile will let you read from he handle. But I wouldn't expect it to work with the parallel port. You'll need a special cable to connect to computers together to transfer data. You won't be able to read any data back from a printer.
If you are transferring data between two computers, you'll find that there is very little help available on the subject simply because it's a technology that wasn't used very much to begin with and was replaced by networks a long time ago.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a couple of multiple queries that I have to perform that exist in 2 seperate methods. These methods are called within another method, where a SQLconnection is created and passed in to each of the queryMethods.
For some reason when I obtain the SQLDataReader ( = sqlCommand.ExecuteReader)
throws an error in the second method.
As soon as I use a seperate connection everything works, is there something that I don't understand here with using connections?
|
|
|
|
|
No, theres nothing special there. But without seeing your code and knowing EXACTLY what exception was thrown and the error message with it, we can only guess at what your problem is.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|