|
Hi mohan_balal
For Q1. if you mean the RDO for data access , that visual basic 6 and prior uses , i think that is for 32 bit systems ( WINDOWS 95 , 98 , NT , 2000 , XP ) , but im not sure that RDO plays with 64bit windows.
For Q2. the answers are related with "variables" but for different reasons.
a) you can declare a variable in a procedure or function or inside a code block in a procedure or a function and this variable called "local"
b-c) Impicit , Explicit , hmmmm... this is "instructions" to the compiler ( and /or refers to conversion from one type to other ) tell the behaviour about when you try to give a value from a variable to another variable that isnt excacty the same type, or use a variable in a procedure,function or method or property call that isnt actual the same type as in the definitions of all those ( general speaking ).
d) Private. In a class definition you can give a "visibility" to members functions or variables . an examble
.....
class aaaa
private var1 as string
public var2 as string
private sub sub1
end sub
public sub sub2
end sub
end class
.....
when you later in your rest code you use an object of type aaaa you can refer only to var2 and sub2 because are the only visible outside of the class !! the "word" private "hides" the var1 and var2 from outside the class/object
I Hope I helped you ....
Ramaseb
Ramaseb.
|
|
|
|
|
I have a hard time to understand this file DataGridButtonColumn.vb, is there someone can explain it to me? I really need this code to work. Thank you for all your help!
Option Strict Off
Option Explicit On
Imports Microsoft.VisualBasic
Imports System
Imports System.Drawing
Imports System.IO
Imports System.Reflection
Imports System.Windows.Forms
_
Public Class DataGridButtonColumn
Inherits DataGridTextBoxColumn
Public Event CellButtonClicked As DataGridCellButtonClickEventHandler
Private _buttonFace As Bitmap
Private _buttonFacePressed As Bitmap
Private _columnNum As Integer
Private _pressedRow As Integer
Public Sub New(ByVal colNum As Integer)
_columnNum = colNum
_pressedRow = -1
Try
Dim strm As System.IO.Stream = Me.GetType().Assembly.GetManifestResourceStream("fullbuttonface.bmp")
_buttonFace = New Bitmap(strm)
strm = Me.GetType().Assembly.GetManifestResourceStream("fullbuttonfacepressed.bmp")
_buttonFacePressed = New Bitmap(strm)
Catch
End Try
End Sub
Private Sub DrawButton(ByVal g As Graphics, ByVal bm As Bitmap, ByVal bounds As Rectangle, ByVal row As Integer)
Dim dg As DataGrid = Me.DataGridTableStyle.DataGrid
Dim s As String = dg(row, Me._columnNum).ToString()
Dim sz As SizeF = g.MeasureString(s, dg.Font, bounds.Width - 4, StringFormat.GenericTypographic)
Dim x As Integer = bounds.Left + Math.Max(0, (bounds.Width - sz.Width) / 2)
g.DrawImage(bm, bounds, 0, 0, bm.Width, bm.Height, GraphicsUnit.Pixel)
If (sz.Height < bounds.Height) Then
Dim y As Integer = bounds.Top + (bounds.Height - sz.Height) / 2
If (_buttonFacePressed Is bm) Then
x = x + 1
End If
g.DrawString(s, dg.Font, New SolidBrush(dg.ForeColor), x, y)
End If
End Sub
Protected Overloads Overrides Sub Edit(ByVal [source] As System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal bounds As System.Drawing.Rectangle, ByVal [readOnly] As Boolean, ByVal instantText As String, ByVal cellIsVisible As Boolean)
End Sub 'Edit
Public Sub HandleMouseUp(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim dg As DataGrid = Me.DataGridTableStyle.DataGrid
Dim hti As DataGrid.HitTestInfo = dg.HitTest(New Point(e.X, e.Y))
Dim isClickInCell As Boolean = (hti.Column = Me._columnNum And hti.Row > -1)
_pressedRow = -1
Dim rect As New Rectangle(0, 0, 0, 0)
If isClickInCell Then
rect = dg.GetCellBounds(hti.Row, hti.Column)
isClickInCell = e.X > rect.Right - Me._buttonFace.Width
End If
If isClickInCell Then
Dim g As Graphics = Graphics.FromHwnd(dg.Handle)
DrawButton(g, Me._buttonFace, rect, hti.Row)
g.Dispose()
RaiseEvent CellButtonClicked(Me, New DataGridCellButtonClickEventArgs(hti.Row, hti.Column))
End If
End Sub
Public Sub HandleMouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim dg As DataGrid = Me.DataGridTableStyle.DataGrid
Dim hti As DataGrid.HitTestInfo = dg.HitTest(New Point(e.X, e.Y))
Dim isClickInCell As Boolean = (hti.Column = Me._columnNum And hti.Row > -1)
Dim rect As New Rectangle(0, 0, 0, 0)
If isClickInCell Then
rect = dg.GetCellBounds(hti.Row, hti.Column)
isClickInCell = e.X > rect.Right - Me._buttonFace.Width
End If
If isClickInCell Then
Dim g As Graphics = Graphics.FromHwnd(dg.Handle)
DrawButton(g, Me._buttonFacePressed, rect, hti.Row)
g.Dispose()
_pressedRow = hti.Row
End If
End Sub
Protected Overloads Overrides Sub Paint(ByVal g As System.Drawing.Graphics, ByVal bounds As System.Drawing.Rectangle, ByVal [source] As System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal backBrush As System.Drawing.Brush, ByVal foreBrush As System.Drawing.Brush, ByVal alignToRight As Boolean)
Dim parent As DataGrid = Me.DataGridTableStyle.DataGrid
Dim current As Boolean = parent.IsSelected(rowNum) Or (parent.CurrentRowIndex = rowNum And parent.CurrentCell.ColumnNumber = Me._columnNum)
Dim BackColor As Color
If current Then BackColor = parent.SelectionBackColor Else BackColor = parent.BackColor
Dim ForeColor As Color
If current Then ForeColor = parent.SelectionForeColor Else ForeColor = parent.ForeColor
g.FillRectangle(New SolidBrush(BackColor), bounds)
Dim s As String = Me.GetColumnValueAtRow([source], rowNum).ToString()
Dim bm As Bitmap
If _pressedRow = rowNum Then bm = Me._buttonFacePressed Else bm = Me._buttonFace
DrawButton(g, bm, bounds, rowNum)
End Sub
End Class
The main part I dont understand is the drawbutton, HandleMouseUp, HandleMouseDown Sub.
Lisa
|
|
|
|
|
Option Strict Off
Option Explicit On
Imports Microsoft.VisualBasic
Imports System
Imports System.Drawing
Imports System.IO
Imports System.Reflection
Imports System.Windows.Forms
Namespace DataGridButton
_
Public Class DataGridButtonColumn
Inherits DataGridTextBoxColumn
Public Event CellButtonClicked As DataGridCellButtonClickEventHandler
Private _buttonFace As Bitmap
Private _buttonFacePressed As Bitmap
Private _columnNum As Integer
Private _pressedRow As Integer
Public Sub New(ByVal colNum As Integer)
_columnNum = colNum
_pressedRow = -1
Try
Dim strm As System.IO.Stream = Me.GetType().Assembly.GetManifestResourceStream("fullbuttonface.bmp")
_buttonFace = New Bitmap(strm)
strm = Me.GetType().Assembly.GetManifestResourceStream("fullbuttonfacepressed.bmp")
_buttonFacePressed = New Bitmap(strm)
Catch
End Try
End Sub 'New
Private Sub DrawButton(ByVal g As Graphics, ByVal bm As Bitmap, ByVal bounds As Rectangle, ByVal row As Integer)
Dim dg As DataGrid = Me.DataGridTableStyle.DataGrid
Dim s As String = dg(row, Me._columnNum).ToString()
Dim sz As SizeF = g.MeasureString(s, dg.Font, bounds.Width - 4, StringFormat.GenericTypographic)
Dim x As Integer = bounds.Left + Math.Max(0, (bounds.Width - sz.Width) / 2)
g.DrawImage(bm, bounds, 0, 0, bm.Width, bm.Height, GraphicsUnit.Pixel)
If (sz.Height < bounds.Height) Then
Dim y As Integer = bounds.Top + (bounds.Height - sz.Height) / 2
If (_buttonFacePressed Is bm) Then
x = x + 1
End If
g.DrawString(s, dg.Font, New SolidBrush(dg.ForeColor), x, y)
End If
End Sub
Protected Overloads Overrides Sub Edit(ByVal [source] As System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal bounds As System.Drawing.Rectangle, ByVal [readOnly] As Boolean, ByVal instantText As String, ByVal cellIsVisible As Boolean)
End Sub 'Edit
' dont call the baseclass so no editing done...
' base.Edit(source, rowNum, bounds, readOnly, instantText, cellIsVisible);
Public Sub HandleMouseUp(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim dg As DataGrid = Me.DataGridTableStyle.DataGrid
Dim hti As DataGrid.HitTestInfo = dg.HitTest(New Point(e.X, e.Y))
Dim isClickInCell As Boolean = (hti.Column = Me._columnNum And hti.Row > -1)
_pressedRow = -1
Dim rect As New Rectangle(0, 0, 0, 0)
If isClickInCell Then
rect = dg.GetCellBounds(hti.Row, hti.Column)
isClickInCell = e.X > rect.Right - Me._buttonFace.Width
End If
If isClickInCell Then
Dim g As Graphics = Graphics.FromHwnd(dg.Handle)
' g.DrawImage(Me._buttonFace, rect.Right - Me._buttonFace.Width, rect.Y)
DrawButton(g, Me._buttonFace, rect, hti.Row)
g.Dispose()
'If Not (CellButtonClicked Is Nothing) Then
RaiseEvent CellButtonClicked(Me, New DataGridCellButtonClickEventArgs(hti.Row, hti.Column))
'End If
End If
End Sub 'HandleMouseUp
Public Sub HandleMouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim dg As DataGrid = Me.DataGridTableStyle.DataGrid
Dim hti As DataGrid.HitTestInfo = dg.HitTest(New Point(e.X, e.Y))
Dim isClickInCell As Boolean = (hti.Column = Me._columnNum And hti.Row > -1)
Dim rect As New Rectangle(0, 0, 0, 0)
If isClickInCell Then
rect = dg.GetCellBounds(hti.Row, hti.Column)
isClickInCell = e.X > rect.Right - Me._buttonFace.Width
End If
If isClickInCell Then
'Console.WriteLine("HandleMouseDown " + hti.Row.ToString());
Dim g As Graphics = Graphics.FromHwnd(dg.Handle)
'g.DrawImage(Me._buttonFacePressed, rect.Right - Me._buttonFacePressed.Width, rect.Y)
DrawButton(g, Me._buttonFacePressed, rect, hti.Row)
g.Dispose()
_pressedRow = hti.Row
End If
End Sub 'HandleMouseDown
Protected Overloads Overrides Sub Paint(ByVal g As System.Drawing.Graphics, ByVal bounds As System.Drawing.Rectangle, ByVal [source] As System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal backBrush As System.Drawing.Brush, ByVal foreBrush As System.Drawing.Brush, ByVal alignToRight As Boolean)
'base.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight);
Dim parent As DataGrid = Me.DataGridTableStyle.DataGrid
Dim current As Boolean = parent.IsSelected(rowNum) Or (parent.CurrentRowIndex = rowNum And parent.CurrentCell.ColumnNumber = Me._columnNum)
Dim BackColor As Color
If current Then BackColor = parent.SelectionBackColor Else BackColor = parent.BackColor
Dim ForeColor As Color
If current Then ForeColor = parent.SelectionForeColor Else ForeColor = parent.ForeColor
'clear the cell
g.FillRectangle(New SolidBrush(BackColor), bounds)
'draw the value
Dim s As String = Me.GetColumnValueAtRow([source], rowNum).ToString() 'parent[rowNum, 0].ToString() + ((parent[rowNum, 1].ToString())+ " ").Substring(0,2);
'Font font = new Font("Arial", 8.25f);
'g.DrawString(s, font, new SolidBrush(Color.Black), bounds);
'g.DrawString(s, parent.Font, New SolidBrush(ForeColor), bounds.X, bounds.Y)
'draw the button
Dim bm As Bitmap
If _pressedRow = rowNum Then bm = Me._buttonFacePressed Else bm = Me._buttonFace
'g.DrawImage(bm, bounds.Right - bm.Width, bounds.Y)
DrawButton(g, bm, bounds, rowNum)
End Sub 'Paint 'font.Dispose();
End Class 'DataGridButtonColumn
End Namespace
|
|
|
|
|
By the way, you can find the original source code here:
http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q888q
|
|
|
|
|
thanks..I have the code, but I just don't understand the whole app. I have to understand it before I create mine..but it's bother me a lot now I can't understand the code..do you know anyway I can learn for it and understand it?
Lisa
|
|
|
|
|
The trick to this app is the author is not using a button control at all. He's using GDI+ to draw an image to emulate a button. In the drawbutton function, the size of tha data in that column is measured, and the image is drawn to be slightly larger.
The handle mousedown method is just to change the image of the button to the pushed button image, and assign the tells the class which row was pressed.
Then in the handle mouseup method, the CellButtonClicked event is raised, and image is redrawn to be the normal button image.
HTH
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
I don't know any of the GDI+, that's why I can't understand that..is there any other ways to do this app? I very need that button to be inside the output data, and when it clicks, then open another form.
Thanks Nick!
Lisa
|
|
|
|
|
i have created a crystal report. but when i was already browsing it, i encountered this problem....
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30389: 'C' is not accessible in this context because it is 'Private'.
Source Error:
Line 12:
Line 13:
Line 14: <cr:crystalreportviewer id="CrystalReportViewer1" style="Z-INDEX: 101; LEFT: 192px; POSITION: absolute; TOP: 35px" runat="server" width="1029px" height="1090px" reportsource="<%#C:\\inetpub\wwwroot\reports\trial.rpt %>">
Line 15:
Line 16:
Source File: c:\inetpub\wwwroot\Reports\WebForm1.aspx Line: 14
i really need your help as soon as possible.. tnx!
|
|
|
|
|
You need to put < on all your tags. The source is not readable otherwise.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Can anybody tell me where I can find documentation on the use of the Kodak Image controls?
Thanks
Brad
|
|
|
|
|
The Kodal Image Controls originally started out as Imaging for Windows. Microsoft sold it to Wang, who then sold it to Kodak, who then sold it to iLixis, who then sold it to eiStream. Now, there is no publicly available documentation on the Kodak version of the controls, but there is on the original Microsoft version here[^]. But, there is no telling how accurate that documentation is as it relates to the version of the controls your using.
See this[^] page for the current owner of the Imaging for Windows product.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks Dave.
I'll check them out.
Brad
|
|
|
|
|
I need to store some data as binary in a file so that another system can read it in. Currently I am using VB 6.0 (not .NET) and have come across a few problems.
I have created a user defined type as follows;
Type mdecTask
sKeyerId As String * 9
stUTCStartSessionTime As Double
dTypingTime As Double
lTypingCount As Long
dAdminTime As Double
lAdminCount As Long
dVuiTime As Double
lVuiCount As Long
stUTCEndSessionTime As Double
lReasonForEndSession As Long
sOtherReason As String * 256
End Type
Public mTask As mdecTask ' Defines a record.
and have then written data to some of the structure.
I have then opened the file for binary access as follows;
'Open the log file and write to it the info so far collected
miFileNumber = FreeFile
Open msFileToOpen For Binary Access Write Lock Read Write As #miFileNumber
and then I have put the data into the file and closed it as follows;
Put #miFileNumber, , mTask
Close #miFileNumber
Everything seems to work fine, but when I view the file in a hex editor the time values I store are different, for example the UTC time obtained for the mTask.stUTCStartSessionTime is 1092217616, which I can see in the structure when I debug the application, but when I view the in hex the file, it's 41467AC4, when it should be 4119EB10. The order is around the other way in the hex file, i.e. C4 7A 46 D0 41 (the D0 should be ignored, I think?) and I known that's to do with big endian and little endian.
Does anyone have a reason why this is happening. Also when I try to read the file back into the structure using 'Get' its all zeroes.
|
|
|
|
|
An update to the above problem is that if I use the CreateFile and WriteFile Win32API calls and specify the length of bytes to write to the file as LenB(mTask) then I get 588 bytes written instead of only 321. If I then view the file I can find the stUTCStartSessionTime value down near the bottom amongst a load of unknown hex.
|
|
|
|
|
Simon Kearn wrote:
if I use the CreateFile and WriteFile Win32API calls and specify the length of bytes
Why go through all that trouble...
As per your original problem... If you look at the Binary representation of both number, the problem should become clear:
You required time value:
4119EB10 = 01000001000110011110101100010000
The value your getting:
41467AC4 = 01000001010001100111101011000100
If you look at the binary versions closely, you'll find that the bulk of your value is being moved to the left two places and a 01 is being inserted. This is because your eyes are looking at the number as an Integer and the value being stored is a 64-bit Double (floating point value). The two data types are stored differently.
You required time value:
4119EB10 = 01000001 000110011110101100010000
The value your getting:
41467AC4 = 01000001010001100111101011000100
Your time value should be stored as a Long (32-bit signed Integer) instead of a Double. I thinkth is should get you a step closer to solving your problem.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi there, i'm looking for any program on pdf conversion from ms word to pdf. Are there any free utility out there. Appreciate the help given. Thx
|
|
|
|
|
Why don’t you simply use Adobe Acrobat (not Reader)? It will work
sony speed
|
|
|
|
|
There are no small example programs because the complexity of whats involved. The best ones are actually printer drivers, not programs. The output from Word is "printed" to the driver and the driver is then able to take exactly what Word sends and assemble the .PDF without having to know anything about Word's file format.
If you want examples, search the Open Source sites for "PDF". You end up with lots of libraries and projects, like PDFCreator[^] on SourceForge.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ever notice that the MessageBox does not have the XP look while the MsgBox does? Anybody know how to do this?
|
|
|
|
|
AFAIK, MsgBox is essentially a call to MessageBox.Show
It just defaults some parameters like caption, etc.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
Its a separate class, included jst for backward compatibility to VB6 developers.
|
|
|
|
|
Hello everyone,
I am really new with Visual Basic .NET 2003 and have come across a problem that I cannot seem to figure out. I have spent a lot of time reading in books and articles to figure this out, and because it is such a simple problem - it is quite frustrating.
I am making a Tic Tac Toe game to get more familiar with VB. I have already finished a very simple Tic Tac Toe program and now am moving into an advanced version with multiple forms. Each form acts like the next screen within the game - so, I wanted to make it so that the forms would hide and show themselves in the same area as the last screen. Also, at the bottom of the screen - the task bar resets every time a form is loaded.
Any information on how to manage multiple forms to act as if they are only one form would be great. Articles, Links, Examples, anything you can spare.
My current way for showing and hiding a form is:
dim testform as new testform
testfor.show()
I am using key words Show, Close, and Hide. Well, anything would be helpful. Thanks!
~Achithyn
|
|
|
|
|
A suggestion. How about using an MDI application, and letting your forms be a children within the parent?
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
I will look into MDI forms and see what happens ) Thank you for the prompt reply! If there is anything else that may be able to help me make this little program of mine, feel free to share. Thanks again - I will see what happens and, depending, post back here.
~Achithyn
|
|
|
|
|
No Prob. I too, once tried to make a tic tac toe program. It wasn't too good, but it was fun.
Good luck with your app.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|