|
I created set of radio buttons which depending on what is selected will make a DIV tag visible or hidden, but since this is only client side code every time I do a submit on my form the div tag will appear. And this is whether on not the radio button which hides my div tag is selected.
So to solve this I created a JavaScript function which will check to see which radio button is selected and either hide the div tag or make it visible, but I have not found a way to call the function. I went into the HTML CODE on my VB page and added a onload call to my function from the body tag but this also didn’t work. I do understand that attributes can be added to a button but only events. My question is, "Does anyone know how to call a JavaScript function every time the page is loaded"?
Thanks
|
|
|
|
|
Hi ...
in the code below this javascript must be runing every time the page is loaded ( i think ..)
<HTML>
<body>
/* other page stuff here
*/
<script>
/*Current date script credit:
JavaScript Kit (www.javascriptkit.com)
Over 200+ free scripts here!
*/
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","Mai","June","July","August","September","October","November","December")
document.write("<div style ='position: absolute; left:8; bottom:10' ><small><font face='Times New Roman'>"+dayarray[day]+" "+daym+" "+montharray[month]+" "+year+"</font></small></div>")
</script>
</body>
</HTML>
as you understand the script runs and writes something in the page ( i thing the date info )
Maybe if you use the same aproach as the example you can do that you want.
Hope i helped you
Ramaseb.
Ramaseb.
|
|
|
|
|
Thanks that is a good idea let me try it.
|
|
|
|
|
You fashion your javascript so that it can be placed in the <head></head> section of your HTML. This gets processed EVEN BEFORE the body loads.
|
|
|
|
|
Thanks, this worked.
|
|
|
|
|
I have a MS Word document and I'm iterating through every Shape/Inline shape in it (I'm using VB .NET). And I want to save each of these shapes into a separate file. If its an image/drawing/diagram then in a GIF file, if its an audio then MP3/WAV/MIDI file and so on.
However I'm having problems with embedded OLE objects. I have a MP3 and a RAM file embedded in the document. But I can't seem to find any way to get a handle to these objects or the link to these files.
I tried OLEFormat.object but I get an "No such interface supported" error.
Smriti
|
|
|
|
|
Hi..
have you used the new stuff from OFFICE 2003 , ( the new object model and
the native .net support ) !! you can find some info at msdn.microsoft.com
or
http://msdn.microsoft.com/office/understanding/officesystem/codesamples/default.aspx?pull=/msdnmag/issues/03/09/microsoftoffice2003/toc.asp
Hope I helped you..
Ramaseb
Ramaseb.
|
|
|
|
|
Yup, I'm using the new model only. I don't know about the old model but the new document is like this:
Shape/InlineShape -> OleFormat property -> Object property
The OLEFormat property is supposed to be used when the shape is an OLE object. So in case of images I access the image through Shape.OLEFormat.object. But it doesn't seem to work when the object is an audio/video file.
Thanks anyway,
Smriti
|
|
|
|
|
Hello ..
Please can anyboddy help me to this problems??
I'm trying to use foxpro tables ( !! ) with foxpro oledb provider.
My first problem is that Visual Studio cannot understand key columns so , no update and delete statements are produced for data adapters.
I bypass this problem by "copying" the table to a sql database , set the key collumns , create an oledb data adapter to sql database/table ( everything created ok !!) and then change the connection string to foxpro ole db provider !!
My second problem is that when i try to issue a foxpro command like "append from file delimited" i get a message for "errors during processing command" and nothing is loaded to the table !! Other commands like PACK table , or DELETE ALL FROM TABLE , are working fine !! The same delimited file is processed with out errors inside the foxpro 9 ( beta ) environment.
Any suggestions...??
Thank's , and i'am sorry for my terrible english.
Ramaseb.
|
|
|
|
|
Q1. RDO is supported only on___BIT Operating System
Choices are:
a)8
b)16
c)32
d)64
Q2. If the variable is created by Visual Baisc it is called
Choices are:
a)Local
b)Implicit
c)Explicit
d)Private
Mohan Balal
|
|
|
|
|
We're not doing your homework for you...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
... too late, someone already did.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
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.
|
|
|
|
|