|
Hi..
are tou sure that the dll "exports" the function??
Ramaseb.
|
|
|
|
|
I am sorry to bother everyone again, though I had another quick question. What determines what form will show first within your project? Let us say we had three forms, what value, code or settings states that Form1 shows first?
I want to add a form before my main form - such as a flash screen - or just another form for anything - though do not know how to make it and then have it load first rather than when it is called by form1. Any help would be greatly appreciated.
Links, Articles, Books, anything would help. Thanks!
~Achithyn
|
|
|
|
|
you set the statup object in the project properties. assuming you are using vs.net right click your project in the solution explorer and click properties.
the properties dialog will come up and should default to the "Common Properties - General" page. In here you'll see a combobox titled "Startup Object" listing your options for the main form/object.
when you expand this combobox you should basically have any forms you have created in your project, select whichever one you wish to be the main form.
hope this helps.
-jim
|
|
|
|
|
In addition to what jmatthew said, splash screens should not be the Startup Form. The first form that is executed can not be unloaded unless you want your app to quit. The first, or main, form should be your startup form, then this form can load and show the splash form while the main form is doing it's initialization. When that's complete, the main form can hide and the dispose the splash form, then show itself.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
That is truly awesome. I found the properties section of everything else 'other' than the projects properties - now I have that as well. This opens up a lot more for me to explore and answers several questions that I would have eventually asked if I had not discovered this (learned of it from both of you).
As for Hiding and Closing the main form - I understand now how that works and will work with it to make my program better. Thanks for the help both of you - it is mightily helpful.
~Achithyn
|
|
|
|
|
Hi..
some more info.
When you set in project properties the "start-up object”, setting so the first form as a start-up form, behind the scenes the Visual Studio adds a sub Main to your form. The sub Main is the entry point for your application. If you declare this sub Main in the startup form , you can put any code in this sub and control the start up behaviour of your application. Try to search the help for the sub main, and see what you can do there.
Hope i helped you.
Ramaseb.
|
|
|
|
|
Awesome, I will do just that. Thank you for letting me know about the sub Main - I will see how I can use it to help my applications.
Thanks!
~Achithyn
|
|
|
|
|
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.
|
|
|
|
|