|
That did it. I didn't have the 'set' in the call to the method.
Thank you!
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
It's scary that I still remember that crap from 2001.
|
|
|
|
|
|
Good day friends, I am trying to check the status of a printer connected to a system from VB.Net application.
But when I start the application, it shows the following error: Object reference not set to an instance of an object. pointing to the PrintQueue.
I made a successful reference to the System.Print.
Imports System.Printing
Public Class Form1
Private Sub ConnectionStatusToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ConnectionStatusToolStripMenuItem.Click
If thPQueue.IsOffline = True Then
MsgBox("The printer is currently offline.", vbInformation + vbOKOnly, "Printer Status")
ElseIf thPQueue.IsWaiting Then
MsgBox("The printer is on wait mode.", vbInformation + vbOKOnly, "Printer Status")
ElseIf thPQueue.IsWarmingUp Then
MsgBox("The printer is currently warming up. Please wait", vbInformation + vbOKOnly, "Printer Status")
ElseIf thPQueue.IsNotAvailable Then
MsgBox("The printer is currently not available.", vbInformation + vbOKOnly, "Printer Status")
End If
End Sub
End Class
Any solution will be appreciated. Thanks in advance!
|
|
|
|
|
If thPQueue Is Nothing Then
MsgBox("Printer queue not initialized.", vbCritical + vbOKOnly, "Printer Status")
ElseIf ...
Now debug your code and find out why thPQueue has not been initialized.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks for your quick response. But how can check if the thPQueue is been initialized or not?
|
|
|
|
|
If it's Nothing , then it hasn't been initialized.
Debug your code and step through the part that creates the PrintQueue . Either it's not being executed, or it's not doing what you expect.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi All,
Please can any one help with a sample code to store DICOM files into mssqlserver dataase. Thanks
|
|
|
|
|
The format of the file is not important to the database; binary data is all stored the same way. Any tutorial that shows how to save a picture in a database should work.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Goggle for "vb.net store images in SQL Server". A DICOM image is no different than any other blob you might store in the database.
Depending on what your app is doing, you really wouldn't store the images in the database, but you would store all the metadata for that image, including a path to the actual image file, which you store on disk in a well-known location somewhere.
|
|
|
|
|
A VB.NET 2010 desktop application is being setup to use Access 2013 and Access 2016 as the database on a new workstation.
The workstation is setup with Windows 10 and office 2016. The application runs for awhile and then the following error occurs:
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
I have seen that there are some links on the internet of saying that the problem is, however none of them are like my situation.
Here is a link that is similar but in refers to share point:
"https://www.layer2solutions.com/en/community/FAQs/BDLC/Pages/How-to-access-office-2010-data-from-sharepoint.aspx".
Thus can you tell me what I can do to solve my problem?
|
|
|
|
|
Please help me when I m printing through following codes it prints in Chinese instead of Arabic
=======================================
'Print heading line.
With .Font
.Name = "Arial Unicode MS"
.Size = 11
.Underline = False
End With
.PrintLine Utf8BytesFromString(TextLine) 'Join$(ParseCSV(TextLine), vbTab)
=============================
Private Declare Function WideCharToMultiByte Lib "kernel32" ( _
ByVal CodePage As Long, _
ByVal dwFlags As Long, _
ByVal lpWideCharStr As Long, _
ByVal cchWideChar As Long, _
ByVal lpMultiByteStr As Long, _
ByVal cbMultiByte As Long, _
ByVal lpDefaultChar As Long, _
ByVal lpUsedDefaultChar As Long) As Long
' CodePage constant for UTF-8
Private Const CP_UTF8 = 65001
''' Return byte array with VBA "Unicode" string encoded in UTF-8
Public Function Utf8BytesFromString(strInput As String) As Byte()
Dim nBytes As Long
Dim abBuffer() As Byte
' Get length in bytes *including* terminating null
nBytes = WideCharToMultiByte(CP_UTF8, 0&, ByVal StrPtr(strInput), -1, vbNull, 0&, 0&, 0&)
' We don't want the terminating null in our byte array, so ask for `nBytes-1` bytes
ReDim abBuffer(nBytes - 2) ' NB ReDim with one less byte than you need
nBytes = WideCharToMultiByte(CP_UTF8, 0&, ByVal StrPtr(strInput), -1, ByVal VarPtr(abBuffer(0)), nBytes - 1, 0&, 0&)
Utf8BytesFromString = abBuffer
End Function
|
|
|
|
|
Does the printer even support Arabic? You're not sending a Windows Unicode font to the printer. You're sending raw bytes which the printer has to interpret as text itself. This is probably NOT going to be Unicode compliant.
But, only the documentation on the printer is going to tell you anything useful.
|
|
|
|
|
Hi,
I need some help wilt listviewgroups.
- How can I find the group that I click/dblclick.
I tryed with
Private Sub ListViewCollapsible1_MouseDown(sender As Object, e As MouseEventArgs) Handles ListViewCollapsible1.MouseDown
Dim lv As ListViewCollapsible = sender
Dim lvi As ListViewItem = lv.HitTest(e.X, e.Y).Item
If lvi Is Nothing Then
For n = 0 To (lv.Font.Size * 2)
Dim ht As ListViewHitTestInfo = lv.HitTest(e.X, e.Y + n)
If ht.Item IsNot Nothing Then
Dim g As ListViewGroup = ht.Item.Group
Dim gs As New ListViewGroupState
Dim sTag As String = g.Tag & " "
If sTag.Contains("collapsed") Then
lv.SetGroupState(ListViewGroupState.Normal, ht.Item.Group)
ht.Item.Group.Tag = "Collapsed"
Else
lv.SetGroupState(ListViewGroupState.Collapsed, ht.Item.Group)
ht.Item.Group.Tag = ""
End If
Exit For
End If
Next
End If
End Sub
but when the group is collapsed the code find nothing
How can I add an icon to a group?
I added an imagelist but groups don't have an imageindex.
Jan
|
|
|
|
|
Never mind.
I was working with an convert from C#
what was working except the questions above but forgot 1 line
lvLijst.SetGroupState(ListViewGroupState.Collapsible)
|
|
|
|
|
I was trying to reset or clear Cookie values, not the entire cookie for which I am setting. So the issue is when I try to process the transaction on Page 1 and go to the Page 2 and come back to Page 1 it is good (for the first time) but however when again I try to make some changes in Page 1 and go to the Page 2 and come back to Page 1 it is showing me the first selected values. The issue is the cookie values are not getting cleared (after the first time) or getting reset for the second transaction (second time). There are two different methods are being called Page_Load and SavePage so Next button will trigger SavePage method and when I try to come back to Page 1 Page_load is getting fired. The code I used in the both methods are.
Can anyone please help me resetting the cookie values or clearing the cookie values for the first after setting. Thanks.
Page_Load Method
blnCSRVerify = CBool(If(chkCSRVerify.Checked = True, 1, 0))
blnCustomerDecline = CBool(If(chkCustomerDecline.Checked = True, 1, 0))
If CustomerCookie.IsCSRVerify Then
chkCSRVerify.Checked = True
End If
If CustomerCookie.IsCustomerDecline Then
chkCustomerDecline.Checked = True
End If
If CustomerCookie.IsSurrenderCredentials <> const_DefaultValForSurrCred Then
If CBool(CustomerCookie.IsSurrenderCredentials) OrElse CBool(optlstVerification.YesSelected) Then
optlstVerification.SelectedValue = CStr(1)
Else
optlstVerification.SelectedValue = CStr(0)
End If
End If
SavePage()
Dim blnCSRVerify As Boolean = False
Dim blnCustomerDecline As Boolean = False
blnCSRVerify = CBool(If(chkCSRVerify.Checked = True, 1, 0))
blnCustomerDecline = CBool(If(chkCustomerDecline.Checked = True, 1, 0))
Dim objContext As HttpContext = HttpContext.Current
Dim objCustomerCookie As HttpCookie = objContext.Request.Cookies("StarsCustomer")
If blnCSRVerify Then
objCustomerCookie.Values.Set("CSR_Verify", CStr(blnCSRVerify))
End If
If blnCustomerDecline Then
objCustomerCookie.Values.Set("CustomerDecline", CStr(blnCustomerDecline))
End If
objCustomerCookie.Values.Set("SurrenderCredentials", optlstVerification.SelectedValue.ToString)
objContext.Response.Cookies.Add(objCustomerCookie)
|
|
|
|
|
Hi,
The HttpContext.Request.Cookie is what's come from client. It will not be automatically sent back to client.
Try changing the value in HttpContext.Current.Response.Cookies collection and set the value. The changed value should be reflected in subsequent request.
|
|
|
|
|
Hi! this is Hamza Arshad. i'm facing a problem with visual basic. Cannot insert explicit value for identity column in table 'Student' When IDENTITY_INSERT is set to OFF.
This is the error. Can anyone help me fix this please. Thanks
|
|
|
|
|
As the error quite clearly says, you have a SQL Server table with an IDENTITY column. Your code is trying to insert an explicit value into that column. You cannot do that.
The solution is simple: don't include the IDENTITY column in your INSERT statement. SQL will assign the next available value, which you can retrieve by using the SCOPE_IDENTITY function.
IDENTITY (Property) (Transact-SQL) | Microsoft Docs[^]
SCOPE_IDENTITY (Transact-SQL) | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
no! i'm not inserting id explicitly but still its giving this error
|
|
|
|
|
Well, given the choice between believing you when you say you're not, and believing the error message which says you are, I know which option my money's on!
Even if you think you're not inserting a value in the IDENTITY column, the error message very clearly tells you that you are.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi,
I'm downloading a large file (+330mb) and getting a memory error (
Not enough storage is available to complete this operation. ) when I assign the response to a byte array (works fine with smaller files <300mb).
I thought I would have been able to download up to 2gb files, so don't know why the error happens.
I have 4gb of memory on my PC and I'm using VB6 under Windows 7.
The arror occurs when I assign the response to the byte array (variable name 'bytFile')
The code is as follows:
Public Function Downloadfile(ByVal vstrName As String) As Boolean
On Error GoTo Handler
Dim bytFile() As Byte
Dim objADO As ADODB.Stream
gstrURL = "https://...URL..../"
vstrName = "LargeFile.zip"
gstrProxyIP = "99.999.9.9:80"
gstrUserID = "userid"
gstrPassword = "password"
gstrZipPath = "d:\"
gstrFile = "LocalSavedFile.zip"
Set greqPFA = New WinHttp.WinHttpRequest
greqPFA.SetProxy 2, gstrProxyIP
greqPFA.SetTimeouts 500000, 500000, 500000, 500000
greqPFA.Open "GET", gstrURL & vstrName, False
greqPFA.SetCredentials gstrUserID, gstrPassword, 0
greqPFA.SetRequestHeader "Content-Type", "text/html; charset=UTF-8"
greqPFA.Send
bytFile = greqPFA.ResponseBody
Set greqPFA = Nothing
Set objADO = New ADODB.Stream
objADO.Type = adTypeBinary
objADO.Open
objADO.Write bytFile
objADO.SaveToFile gstrZipPath & gstrFile, SaveOptionsEnum.adSaveCreateOverWrite
objADO.Close
Set objADO = Nothing
Downloadfile = True
Exit Function
Handler:
Downloadfile = False
End Function
Any thoughts?
|
|
|
|
|
Member 13286611 wrote: Any thoughts? Yes. You should upgrade to VB.NET, as VB6 is no longer supported.
There is also no reason not to. VB.NET is available for free, and would work happily with Win7.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
how to add check box in datagrid in VB 6.0
|
|
|
|