|
please verify your post once again and modify it.
|
|
|
|
|
nitin3 wrote: pls tll me what is the diff between these two declarations
dim i ,j as integer
//and
dim i,j as integerer
The second lacks a space between the i and comma. The second also contains a spelling mistake.
|
|
|
|
|
nitin3 wrote: dim i ,j as integer
//and
dim i as integer
dim j as integer
I don't see any differences!
In vb6 the first statement resulted in declaration of i As Variant and j as integer.
But in VB.NET both declarations are the same!
|
|
|
|
|
yah what u said is correct.
|
|
|
|
|
MohammadAmiry wrote: ..i As Variant and...
dim i ,j as integer ' i thought this declares both i & j as integer.
thanks again
|
|
|
|
|
both are one and the same thing what u suitable u can do it
if u write single line then this is smart work
|
|
|
|
|
in vb 6
-------
Dim a(10), k, j As Integer 'this will not work
'but thi will
Dim a(10) as integer
dim k, j As Integer
'input values 1-10
'-------------------
For j = 1 To 10
a(j) = InputBox("Enter a number")
Next
k = a(1)
For j = 1 To 9
If k < a(j + 1) Then
k = a(j + 1)
End If
Next
MsgBox k
thats why ask about it !!!
thanks for response
|
|
|
|
|
Hello.
When i open the "Project Properties" to change the startup object i get an error message "Value does not fall within the expected range"
I am not able to change the startup object.
Please help me out if anyone has any idea.
Please
Please
|
|
|
|
|
Hi,
People must be aware of the pivot table available in Excel.
I would like to create a pivot table in Vb.Net and allow the user to drag and drop the fields required for the report. (or atleast select the fields from a list), allow drill down, sorting, totalling, sub totalling etc
Is there any ActiveX or OCX control available to do this?
Any help would be of great appreciation.
|
|
|
|
|
Yes there is. One is infragistics>>NetAdvantage>>UltraGrid Control.
It does all you want plus lots of other benefits. Try the trial
|
|
|
|
|
Hi all,
This is the whole of my code, courtesy of Shawn Hall, my issue is olRFC822 is having an error ambiguous name detected. Whats wrong with my code? are there any other reference should I check?
Thanks,
Jj
'// ========================================================
Option Explicit
'[Constants]
Const kExportPath = "C:\My Email\" ' path must exist!
'// ========================================================
'[Support]
Sub ExportMessages()
' variables
Dim OL As Outlook.Application ' Outlook instance
Dim exp As Explorer
Dim ols As Selection
Dim mu As Redemption.MAPIUtils
Dim mi 'As MailItem
Dim lIter&
' toggle commenting on the following two lines to use
' from VB vs Outlook:
'Set OL = CreateObject("Outlook.Application") '// VB
Set OL = ThisOutlookSession '// Outlook
' ignore errors
'On Error Resume Next
' get handle to selection
If Outlook.ActiveExplorer Is Nothing Then Exit Sub
Set exp = Outlook.ActiveExplorer
Set ols = exp.Selection
Set mu = New Redemption.MAPIUtils
For lIter = 1 To ols.Count
Set mi = ols.Item(lIter)
' do it
SaveCDOMessage mi.EntryID
' clean up
Set mi = Nothing
Next lIter
' clean up
Set mi = Nothing
mu.Cleanup
Set mu = Nothing
Set ols = Nothing
Set exp = Nothing
Set OL = Nothing
End Sub
'// ========================================================
Sub SaveCDOMessage(sEntryID)
Dim mu As Redemption.MAPIUtils
Dim objMsg As Redemption.MessageItem
Dim sFilename$, sHeader$, sContents$, aContents
Dim fso As New FileSystemObject
Dim ts As TextStream
sFilename = kExportPath & sEntryID & ".mai"
On Error Resume Next
' export the message
Set mu = CreateObject("Redemption.MAPIUtils")
mu.MAPIOBJECT = Session.MAPIOBJECT
Set objMsg = mu.GetItemFromID(sEntryID)
objMsg.SaveAs sFilename, olRFC822
'objMsg.SaveAs sFilename, olRTF
'objMsg.SaveAs sFilename, olHTML
'objMsg.SaveAs sFilename, olMSG
'objMsg.SaveAs sFilename, olDoc
'objMsg.SaveAs sFilename, olTXT
'objMsg.SaveAs sFilename, olMSGUnicode
' update headers in exported file
sHeader = objMsg.Fields(8192030)
Set ts = fso.OpenTextFile(sFilename, ForReading, True)
sContents = ts.ReadAll
ts.Close
aContents = Split(sContents, vbCrLf & vbCrLf, 2, 1)
aContents(0) = sHeader
Set ts = fso.OpenTextFile(sFilename, ForWriting, True)
ts.Write Join(aContents, vbCrLf & vbCrLf)
ts.Close
Set ts = Nothing
' clean up
Set objMsg = Nothing
mu.Cleanup
Set mu = Nothing
Set fso = Nothing
End Sub
'// ========================================================
-- modified at 22:28 Tuesday 11th September, 2007
|
|
|
|
|
This is way too much code to post. Ambiguous usually means that the name is defined more than once in the same scope in your code.
|
|
|
|
|
how to cut an image in picturebox in VB.Net
like we do in paint setect a part of image and cut it
and keep it in memory........
wana to be a best coder
|
|
|
|
|
Use DrawImage method of Graphics object.
You may try following code –
-----------Start Code----------------
'Create a bitmap object where our picture will be stored
Dim a As Bitmap = New Bitmap(400, 300)
'Create a Graphics object g
Dim g As Graphics = Graphics.FromImage(a)
'Rectangle which has to be cut from the picture
Dim rect As Rectangle = New Rectangle(0, 0, a.Width, a.Height)
'Cut the portion of the image which we have in picturebox1
g.DrawImage(Me.PictureBox1.Image, 0, 0, rect, GraphicsUnit.Pixel)
'Put bitmap image in clipboard,
My.Computer.Clipboard.SetImage(a)
'this image may be accessed using My.Computer.Clipboard.GetImage
---------------End Code------------
I hope this helps .
- Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
In VB.Net how we will convert Image into Text
for example
we have an Image (JPEG) file in which some text is written like (ABCD)
then it should return a String "ABCD".
wana to be a best coder
|
|
|
|
|
You need to write or buy an OCR program. The fact that you're asking, makes it unlikely that you'd be able to write one.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Ok, so, I have a VB2005 Program linked to a database. I also have a datagrid on the form that displays a certain table in the database. Now, randomly the datagrid will rearrange the sort order for no apparent reason. I use PKeys that run off AutoNumbers, so you'd think it would not be that hard and 99.9 % of the time the code will load the correct order, 1,2,3,4,5,6,7,etc... But once in a while it will load up not just backwards or something but just all out of order, 2,5,4,1,6,3,7, etc...
The fill code looks like this :
"Me.TblFruitTableAdapter.Fill(Me.DbScreenDataSet.tblFruit, DatePro)"
Its pretty much computer generated except for i added in a variable for the Date of Production so that when the program loads it only grabs the records for that day, but the records get put in, in order so that day 1 hour 1 is record 1 of the day.
Can anyone explain why 99.9 % of the time it loads the records correctly but once in awhile it will load them distorted?
|
|
|
|
|
Does your SQL have an order by statement ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I'm sorry I forgot to mention that i am using MS Access for my database purposes.
|
|
|
|
|
OK, so build your SQL on each keypress, and filter your data direct from the DB.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
An SQL query is not guaranteed to return records in a specific order unless told to with an ORDER BY clause in the SELECT statement.
|
|
|
|
|
I have a datagrid with a checkbox column. When a user checks a box, leaves the row, re-enters the row and unchecks the box get the following error:
Operator '=' is not defined for type 'DBNull' and type 'Boolean'
The value of the checkbox changes from true or false to DBNull.
How do I avoid this?
Edit/Delete Message
|
|
|
|
|
Without seeing the actual bit of code that is throwing the error, I am guessing that it is the checkbox's CheckedChanged event.
So you might have something like this:
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged<br />
If CheckBox1.Checked = True Then<br />
'something happens here<br />
End If<br />
End Sub
A checkbox control has three states: Checked, Unchecked and Indeterminate.
Simply avoid the = operator, rather use the <> operator:
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged<br />
If CheckBox1.Checked <> False Then<br />
'something happens here<br />
End If<br />
End Sub
Or a little better even (I am not sure whether this works in VB6 though):
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged<br />
If CheckBox1.CheckState = CheckState.Checked Then<br />
'something happens here<br />
End If<br />
End Sub
Otherwise the DBNull error is only thrown by datasets, recordsets, etc. So you might have something like this:
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged<br />
If CheckBox1.Checked = False Then<br />
SomeOtherCheckBox.Checked = DataSet1.Tables(0).Rows(0).Item("SomeOtherBooleanColumnInTheSameTable")<br />
End If<br />
End Sub
In such a case it is wise to use:
If IsDBNull(DataSet1.Tables(0).Rows(0).Item(0)) = False Then<br />
'Something happens here<br />
End If<br />
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Here is the code causing the problem:
Private Sub grdSelect_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles grdSelect.CellValueChanged<br />
If Not mtfLoading Then<br />
checkCell = CType(grdSelect.Rows(e.RowIndex).Cells("Select"), DataGridViewCheckBoxCell)<br />
<br />
If checkCell.Value = True Then<br />
Call EnableObjects(True)<br />
Else<br />
Call EnableObjects(False)<br />
End If<br />
End If<br />
End Sub<br />
checkCell.value gets set to DBNull when rechecked whether it was true or false to begin with and whether or not leaving row.
Since this is a DataGridViewCheckBoxCell I can't use .checked, .checkedChanged, or .checkState.
|
|
|
|
|
You can just add a IsDBNull check before you assign checkCell:
Private Sub grdSelect_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles grdSelect.CellValueChanged<br />
If Not mtfLoading Then<br />
If IsDBNull(grdSelect.Rows(e.RowIndex).Cells("Select")) Then<br />
checkCell = False 'or True, your choice<br />
else<br />
checkCell = CType(grdSelect.Rows(e.RowIndex).Cells("Select"), DataGridViewCheckBoxCell)<br />
End If<br />
If checkCell.Value = True Then<br />
Call EnableObjects(True)<br />
Else<br />
Call EnableObjects(False)<br />
End If<br />
End If<br />
End Sub
By the way, you could write this same code more efficiently like so:
Private Sub grdSelect_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles grdSelect.CellValueChanged<br />
If Not mtfLoading Then<br />
If IsDBNull(grdSelect.Rows(e.RowIndex).Cells("Select")) Then<br />
Call EnableObjects(False) 'Or True, your choice<br />
'Or just do nothing, and simply wait for this event to be triggered again.<br />
else<br />
Call EnableObjects(CType(grdSelect.Rows(e.RowIndex).Cells("Select"), DataGridViewCheckBoxCell))<br />
End If<br />
End If<br />
End Sub
Hope this helps,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|