|
when i tried Dim fs As FileStream = New FileStream((mImageFilePath.ToString(), FileMode.Open) i am getting error message like the image is already using by another process what to do
|
|
|
|
|
It depends on what you are trying to do with the file. You may have to make a temporary copy of the image file and run your processing on that copy instead of the original.
|
|
|
|
|
hai friends
how to Insert a picture in Excel file in a particular Cell
say D25
plz help me
thanks in advance
bye
vijay kumar d
|
|
|
|
|
vijaylumar wrote: how to Insert a picture in Excel file in a particular Cell
say D25
ActiveWorkBook.Sheets("Sheet1").Select
ActiveWorkBook.Sheets("Sheet1").Range("D25").Select
ActiveWorkBook.Sheets("Sheet1").Pictures.Insert([Full path to image here])
HTH
|
|
|
|
|
hello sir i want to create vb project Setup through installshield
and crystal report automatically install through setup
saurabh bhardwaj
|
|
|
|
|
for automatically install crystal report you need to add the crystal report related files by adding merge modlue in ur ssetup.
Thanx hem
|
|
|
|
|
I have created an application which reqiures some administrative privilages.
I am getting problem when program is run by a guest user.
I want to write some code to check if user is administrator or not.
How can i do this...
Help Me...
Gagan
|
|
|
|
|
Hello Gagan use the following code to check if the user is administrator or not...
System.Security.Principal.WindowsIdentity wi = System.Security.Principal.WindowsIdentity.GetCurrent(); System.Security.Principal.WindowsPrincipal wp = new System.Security.Principal.WindowsPrincipal(wi);
if (wp.IsInRole("Administrators"))
MessageBox.Show(wp.Identity.Name + " is an Administrator!");
|
|
|
|
|
Thank You for your help HemJoshi
|
|
|
|
|
Do:
If My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) Then
' Do whatever here.
End If
My.User.IsInRole Method[^]
|
|
|
|
|
Thank you for your help The JZ
|
|
|
|
|
But I want to check this before form loading event.
if user is administrator then
'code here
else
application.exit
endif
Help me...
Gagan
|
|
|
|
|
Form load or Sub New?
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
Is there anything in vb.net similar to OnBeforeKeyPress.
Thanks & Regards
Mishra
|
|
|
|
|
If you are talking about a control, Sure.
Private Sub Button1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Button1.KeyDown
End Sub
or you could just trap the keypress for the entire form with:
Set KEYPREVIEW on the FORM to TRUE and then you can do:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
End Sub
Or
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
End Sub
I hope this helps. If not, just let me know.
modified 18-Dec-21 21:01pm.
|
|
|
|
|
Dear all,
I found a very weird problem here with my Point-Of-Sales System. I'm using VB.NET 2003 connect MySQL 4.0 database for this system. I really can't figured out what happy to the following situation.
I'm trying to update my database for my system but it failed. I have checked the same SQL query using SQLyog and it works. But when I put into my code,it doesn't perform the UPDATE query as I need.
This is the code I used to test using SQLYog:
UPDATE pos_runningno SET Prefix='01',LastNo='80',Length='8' WHERE LocationCode='KK' AND TerminalCode='CTR01' AND Source='RECEIPTNO';
This is the code I put into my VB.NET code:
Try
ObjComm = New OdbcCommand("UPDATE pos_runningno SET Prefix='01',LastNo=' " & strReceiptNo & " ',Length='8' WHERE LocationCode =' " & TerminalLocate & " ' AND TerminalCode='" & TerminalID & "' AND Source='" & strSource & " '", ObjConn)
ObjConn.Open()
ObjComm.ExecuteNonQuery()
ObjConn.Close()
And I have checked it by changing the data 1 by 1 to the variable inside my system and I found that TerminalLocate is the problem. I have set TerminalLocate is s string and the string value is KK. But it doesn't not update at all and doesn't provide any error message from the system.
This is the structure of my database table for this row which I need to use to update:
Field Type Collation Null Key Default Extra Privileges Comment
------------ ----------- ----------------- ------ ------ ------- ------ ------------------------------- -------
LocationCode varchar(10) latin1_swedish_ci NO PRI select,insert,update,references
TerminalCode varchar(10) latin1_swedish_ci NO PRI select,insert,update,references
Source varchar(20) latin1_swedish_ci NO PRI select,insert,update,references
Prefix varchar(5) latin1_swedish_ci YES (NULL) select,insert,update,references
LastNo int(11) (NULL) YES 0 select,insert,update,references
Length int(11) (NULL) YES 0 select,insert,update,references
Anyone can tell me why this weird things could happen? And how to solve this matter?
Thanks for reading and hope to get someone help to solve it.
Regards
Drex
|
|
|
|
|
When any sql update statement does not affect any rows at all, and no error is thrown then it is almost always due to the WHERE clause. With the conditions that are set specifically in the code, no rows will be updated.
It is likely that not all of your variables actually return exactly the values that you tested with.
I suggest you put a textbox somewhere (if possible) and write the entire UPDATE statement to it. Someting like:
dim SqlUpdateStatement as string = "UPDATE pos_runningno SET Prefix='01',LastNo=' " & strReceiptNo & " ',Length='8' WHERE LocationCode =' " & TerminalLocate & " ' AND TerminalCode='" & TerminalID & "' AND Source='" & strSource & " '"
ObjComm = New OdbcCommand(SqlUpdateStatement, ObjConn)
TextBox1.Text = SqlUpdateStatement
ObjConn.Open()
ObjComm.ExecuteNonQuery()
ObjConn.Close()
That way you can take a copy of the actual statement your code is trying to run and test that statement in SQLYog, or at least see exactly what parameters your code is feeding to the sql statement.
Hope it helps,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Yeah,thanks for your idea Mr.Johan. I have solve this problem. Its just a weird problem actually. I solve it as simple as just remove the space within the ' " & TerminalLocate & " ' to >> '"& TerminalLocate &"' solve the problem. I think its a spacing problem,Right?
Thanks for your effort anyway,its a good way to check the error for me too.
Regards
Drex
|
|
|
|
|
Hi Drex,
drexler_kk wrote: ' " & TerminalLocate & " ' to >> '"& TerminalLocate &"'
Actually the problem was apparently as I described, but you did indeed solve it.
Your variable TerminalLocate was correct, but because of the spaces between the single quotes and the double quotes, your code executed the UPDATE statement with the parameter value:
" KK " instead of "KK" as you needed.
In other words, in your code the update statement became:
UPDATE WhatWasYourTablesNameAgain SET WhatWasThatFieldsNameAgain = 'blablabla' WHERE TerminalCode = ' KK '
instead of:
UPDATE WhatWasYourTablesNameAgain SET WhatWasThatFieldsNameAgain = 'blablabla' WHERE TerminalCode = 'KK'
So yes, it was because of the spaces...
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hello friends, it is possible to give format to a TextBox of the following way " 22 Sep 08 ", the first character of the month has to be in capital letters, with the DateTimePicker if it is possible to give format (dd MMM yy), but not as{like} doing to place the first character of the month in capital letters. Thank you and greetings.
|
|
|
|
|
TextBox1.Text = Format(dt, "dd-MM-yyyy")
Found at:
http://www.programmersheaven.com/mb/VBNET/273453/273453/bounded-textbox/?S=B20000[^]
or
If you cast the date as a datetime datatype first, you can then use its methods to format your date. Something like:
' replace string value with your dataset value
dim MyDate as DateTime = "12/06/1966 00:00"
txtMyDate.Text = MyDate.ToString("mm/dd/yyyy")
You can also still use the old VB Format() function.
Found at:
http://forums.devarticles.com/net-development-43/date-formating-a-textbox-in-vb-net-14089.html[^]
If you need any more information. Let me know.
modified 18-Dec-21 21:01pm.
|
|
|
|
|
the second code works well: but since I do to place the first character of the month in capital letters?
|
|
|
|
|
If you use the same routine but change the format, Everything appears fine on my end.
' replace string value with your dataset value
Dim MyDate As DateTime = "9/25/2008 00:00 "
MsgBox(MyDate.ToString("dd/MMM/yyyy"))
Displays as 25/Sep/2008
modified 18-Dec-21 21:01pm.
|
|
|
|
|
I am unable to interact with a any controls inside web browser DocumentComplete sub and I get an error.
Error that I receive in the Immediate Window:
A first chance exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll
Visual Basic 2008 Project Specifications:
.NET Framework 2.0
.COM References Added
Microsoft Internet Controls(ieframe.dll which reports as SHDocVw.dll)
Microsoft HTML Object Library(mshtml.tlb)
Project Consists Of:
1 Form
1 Button
1 Textbox with Multiline set to TRUE
Code Used:
Public Class Form1
Public WithEvents IE As New SHDocVw.InternetExplorer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
IE.Navigate("http://www.msn.net", Nothing, Nothing, Nothing, Nothing)
IE.Visible = True
End Sub
Private Sub IE_DocumentComplete(ByVal pDisp As Object, ByRef URL As Object) Handles IE.DocumentComplete
TextBox1.Text = "Hello"
End Sub
End Class
Thanks in advance for any help that you can post.
-- modified 18-Dec-21 21:01pm.
|
|
|
|
|
Not sure whether this will solve your problem, but try using the WebBrowser control within the .NET Framework.
Change the line :
Public WithEvents IE As New SHDocVw.InternetExplorer
To :
Public WithEvents IE As New System.Windows.Forms.WebBrowser
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|