|
I now know how it works (I inserted the code in a form :S) but the call fuction doesn't work in my form when I want to call the class1 file
|
|
|
|
|
teuneboon,
If you want to put the Delcare Auto Function... in Class1 and then Call it from Form1, do this:
Change the line in your Form1 Button1_Click that reads:
MyMessageBox(0, "Hello World !!!", "Project Title", 0)
Change it to this:
Call Class1.MyMessageBox(0, "Hello World !!!", "Project Title", 0)
progload
|
|
|
|
|
ok now I know alot more about class and dll, thanks all
|
|
|
|
|
If you are talking about a Win32 API DLL, you do it like this:
Declare Function (or Sub) (FunctionName) Lib (Dllname) Alias (Function Name in DLL) then the arguments.
for instance:
Declare Function MsgBox Lib "user32.dll" _
Alias "MessageBox" (ByVal hWnd As Integer, _
ByVal txt As String, ByVal caption As String, _
ByVal Type As Integer) As Integer
Then you could call it like any other function.
There is more info about this here: http://kpdweb.cjb.net/
|
|
|
|
|
If you're using PInvoke, you probably want to check out www.pinvoke.net, they may have done the hard yards for you already.
I was 13 when I started coding. *sigh* That was in 1982.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
The early 80s were a good time to start coding.
It brings back the memories. My dad borrowed a Commodore Pet from work when I was 6. A friend had a Sinclair ZX81 and then my dad bought a ZX Spectrum in 1983.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Yeah, I was aware of all those platforms. I learned on an Applle ][, only when I blew it up did I buy a C64, and then a slew of Amigas over the years. I often think if I'd not tried to build an NMI card, I'd be one of 50 people worldwide writing software for the Mac today.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello...
Working with VS 2005 Final Release. I hava a DataGridView in which I would like the row to be highlighted a different color if the value in the row's "TAG" column is equal to the the text "NOTE_TEXT". All rows that have "NOTE_TEXT" as the value in the "TAG" column should be highlighted.
I know I can use the RowPrePaint event to do this but I am not sure how to determine which rows contain "NOTE_TEXT" in the "TAG" column within that event.
Here is the code for the event pulled from this page[^] (excellent article Btw... )
Private Sub dgvOne_RowPrePaint(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowPrePaintEventArgs) Handles dgvOne.RowPrePaint<br />
<br />
' Do not automatically paint the focus rectangle.<br />
e.PaintParts = e.PaintParts And Not DataGridViewPaintParts.Focus<br />
<br />
' Determine whether the cell should be painted with the <br />
' custom selection background.<br />
<br />
If (e.State And DataGridViewElementStates.Selected) = _<br />
DataGridViewElementStates.Selected Then<br />
<br />
' Calculate the bounds of the row.<br />
Dim rowBounds As New Rectangle( _<br />
Me.dgvOne.RowHeadersWidth, e.RowBounds.Top, _<br />
Me.dgvOne.Columns.GetColumnsWidth( _<br />
DataGridViewElementStates.Visible) - _<br />
Me.dgvOne.HorizontalScrollingOffset + 1, _<br />
e.RowBounds.Height)<br />
<br />
' Paint the custom selection background.<br />
Dim backbrush As New _<br />
System.Drawing.Drawing2D.LinearGradientBrush(rowBounds, _<br />
Me.dgvOne.DefaultCellStyle.SelectionBackColor, _<br />
e.InheritedRowStyle.ForeColor, _<br />
System.Drawing.Drawing2D.LinearGradientMode.Horizontal)<br />
Try<br />
e.Graphics.FillRectangle(backbrush, rowBounds)<br />
Finally<br />
backbrush.Dispose()<br />
End Try<br />
End If<br />
End Sub
I need to change this if statement:
If (e.State And DataGridViewElementStates.Selected) = _<br />
DataGridViewElementStates.Selected Then
so that it decides if the row being painted contains "NOTE_TEXT" in its "TAG" column.
Any ideas? This should be a fun one...
Many thanks!
"Half this game is ninety percent mental."
- Yogi Berra
If you can read thank a teacher, if you can read in English, thank a Marine.
|
|
|
|
|
i had the same situation but i did it in a much simpler way like this:
after binding the datagridview to datatable try this:
Dim i As Integer<br />
Dim font As New Font(DataGridView1.DefaultCellStyle.Font.FontFamily, 7, FontStyle.Bold)<br />
For i = 0 To DataGridView1.RowCount - 2<br />
Dim value As String<br />
value = DataGridView1.Rows(i).Cells("TAG").Value.ToString()<br />
If value = "NOTE_TEXT" Then<br />
DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.PeachPuff<br />
<br />
Try<br />
DataGridView1.Rows(i).DefaultCellStyle.Font = font<br />
Finally<br />
font.Dispose()<br />
End Try<br />
<br />
End If<br />
<br />
Next i
try it worked for me..
abhinav
|
|
|
|
|
|
|
Please dont crosspost, pick the forum which matches your question closest and post it there only.
|
|
|
|
|
|
Why wasn't it relevant to the Web Development and the .NET Framework forums then? Almost every question can be said to be relevant in a lot of the forums.
Even if you think that a post is releveant to several forums, it's bad practise to cross post. If you really really think that you absolutely need to draw attention to your extremely important post in more than one forum, post the question in one forum, and post links to it in the other forum.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks Guffa, if I ever need a wise ass I'll be sure to give you a call
|
|
|
|
|
If you don't talk back when someone informs you of the proper use of the forum, I will not throw wise ass cracks at you.
---
b { font-weight: normal; }
|
|
|
|
|
ironstrike1 wrote: Thanks Guffa, if I ever need a wise ass I'll be sure to give you a call
Better a wise ass than a dumb ass!
- I may disagree with what you have to say, but I shall defend, to the death, your right to say it. --Voltaire (1694-1778)
|
|
|
|
|
Peter Ross (aka ironstrike1) wrote: What did I offend your boyfriend jerkoff?
Nope. He's not bothered by the whole thing.
- I may disagree with what you have to say, but I shall defend, to the death, your right to say it. --Voltaire (1694-1778)
|
|
|
|
|
|
|
Hi,
Thanks for that Progload, I'll have a read, it looks a bit over my head, it may take some time.
With regard to cross posting, no problem at all, I will reword in future if posts are relevant to more than one forum.
I just dont like smart ass, sarcastic replies,
Rgds
Ironstrike
|
|
|
|
|
ironstrike1,
Yes I can understand that, But..it is considered rude here to cross post...
It's mentioned somewhere here every day here.
Most all of us, read all the posts in most of the fourms and we all can see all of the posts from the Latest Comments Page:
http://www.codeproject.com/script/comments/all_comments.asp[^]
So if someone is really interesed in responding they will... no matter what fourm it's in.
Regards,
progload
|
|
|
|
|
I Didnt realise that,
Thanks for the tip
Rgds
Ironstrike
|
|
|
|
|
You are the only person being a wise ass in this thread... it is a sure fire way to get your questions NOT answered.
Crossposting is considered rude on 100% of all online forums I have ever visited, take some time to get to know a place before you start calling people out.
Oh, and FYI I never removed your thread from, nor restored it to, this forum.
PS> You can guarantee I will not be answering any of your future questions.
How to get answers to your questions!! Read it[^]
|
|
|
|
|