Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi Kartikey...
first : i wanna say welcome in dani web...
second : you didn't show any effort from your program..
"We only give homework help to those who show effort" :)
so, when you post thread again please show the effort...effort can make all of people here to understand the problem. thx :P...

if u want to insert or update you must to connect vb.net with sql server 2000.
for better (my opinion) u can use module so u can call every time in all form..
this code for connection module :

Imports System.Data
Imports System.Data.SqlClient  ' this is very important code that u must added 

Module Connect
    Public conn As SqlConnection
    Public Function GetConnect()
        conn = New SqlConnection("Server = YourServerName;" & "initial Catalog = YourDatabaseName;" & " Trusted_Connection=yes")
        Return conn
    End Function
End Module

this following code to insert data in database :

Dim check As Integer
    Dim conn As SqlConnection
    Dim cmdMedical As New SqlCommand
    Dim cmdMedical1 As New SqlCommand
    Dim daMedical As New SqlDataAdapter
    Dim dsMedical As New DataSet
    Dim dtMedical As New DataTable

                Try
                    conn = GetConnect() ' this when u call the module to connected....
                    conn.Open()
                    cmdMedical = conn.CreateCommand
                    cmdMedical.CommandText = "SELECT * FROM Medical WHERE Medical_No='" & Trim(txtMedical_No.SelectedItem) & " ' "
                    daMedical.SelectCommand = cmdMedical
                    daMedical.Fill(dsMedical, "Medical")
                    dtMedical = dsMedical.Tables("Medical")

                    If (dtMedical.Rows.Count > 0) Then
                        MsgBox("Patient With Medical_No " & Trim(txtMedical_No.Text) & " has been added in data base", MsgBoxStyle.OKOnly, "Message :") …
Jade_me commented: nice greetings..:P +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

hi arasten...
sorry for my post before...its code for vb.net but for vb its not different
this is the code :

Shell "shutdown -r -t 00"   ' for restart
Shell "shutdown -s -t 00"  ' for Shutdown
Shell "shutdown -l -t 00"   ' for log off
Shell "shutdown -a -t 00"  ' for abort

but its only work in xp os..
ok. all for the best

Naruse commented: Great Code +1
Jade_me commented: works... +1
ITKnight commented: nice code +1
dnk commented: Good +1
Vega_Knight commented: Worked :) +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

This code Using 'Shell':

Call Shell("Shutdown /s") 'to shutdown

Call Shell("Shutdwon /r") 'to restart

Call Shell("Shutdown /l") 'to logoff

Call Shell("Shutdown /a") 'to Abort

This Code Using 'Managed Code in .NET':

System.Diagnostics.Process.Start (Shutdown", "/s") 'to shutdown

System.Diagnostics.Process.Start("Shutdown", "/r") 'to restart

System.Diagnostics.Process.Start("Shutdown", "/l") 'to logoff

System.Diagnostics.Process.Start("Shutdown", "/a") 'to abort

Choose the one as u like..
The code in my post its a standard command...
You can add the function with more argument like described below:
to shutdown remote machine, add the argument ' /m MyRemoteMachineName' or
to make process delay, add the argument ' /t nn' with 'nn' is number of second eg: Call Shell("Shutdown /s /m upstaircomputer /t 30") 'it will shutdown the upstair computer in 30 second
if you want to know another argument, type shutdown /? in command prompt window

by - risky k (owner)

Vega_Knight commented: Wonderful:) +1
Naruse commented: Great Code :) +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

i m from south east asia. Indonesia...

Jx_Man 987 Nearly a Senior Poster Featured Poster

uh no..i was wrong here.. sorry for the post..its for vb.net radio button...
you must see Mbt925 post thread..this a nice one

Jx_Man 987 Nearly a Senior Poster Featured Poster

in radio button properties :
find back color->select the web tab->choosy the transparent color.

Jx_Man 987 Nearly a Senior Poster Featured Poster

piracy its bad..its same like you still money without do anything...and its happened in my country...so many piracy here.

Jx_Man 987 Nearly a Senior Poster Featured Poster

hmm...it's the demo/trial version...
you just can convert 100 line of project (if i not wrong).
you must to pay to get the full version..i m sorry.

Jx_Man 987 Nearly a Senior Poster Featured Poster
Jx_Man 987 Nearly a Senior Poster Featured Poster

just vote..not comment

joshSCH commented: This is a forum.. people comment on everything, duhhhhh -2
Jx_Man 987 Nearly a Senior Poster Featured Poster

i vote for sports but actually i play others game too. i m really like to played winning eleven (i just like to play football game)...
i play medal of honor, crysis, tenchu, etc ...

Jx_Man 987 Nearly a Senior Poster Featured Poster

white is nice.

Jx_Man 987 Nearly a Senior Poster Featured Poster

not good, im just 14,434

Jx_Man 987 Nearly a Senior Poster Featured Poster

Jogjakarta...
Bali...
But i Loved Ambon very Much

Jx_Man 987 Nearly a Senior Poster Featured Poster

Happy New Year 2008.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Happy New Year all.

Jx_Man 987 Nearly a Senior Poster Featured Poster

i wanna get some chicken soup..

Jx_Man 987 Nearly a Senior Poster Featured Poster

hi all,
i m a newer in c#. a already start to using c# today.
in my first project i make program to add,edit and delete data from database.
i m already do all of them. now i want to showing data in every control (textbox,combobox, etc) when i click datagrid.
i want to specify the row that it use as key to binding data, but i dont have any idea for this. does anybody know how to get value from datagrid??

i m using this following code in vb.net. please give a code in c#.net

Dim i As New integer

i = dgGuru.CurrentRowIndex()

cmdGuru = cnn.CreateCommand
cmdGuru.CommandText = "SELECT * FROM PedidikanGuru where NIP ='" + Trim(dgGuru.Item(i, 0)) + "'"

Trim(dgGuru.Item(i, 0)) -> this code will get the value from coloumn 0 and row i (agree with which row i was clicked)

No | Name |
----|------------|
1 |- Jx -|
2 |- Man -|

so ex, if i click row one i will get my textbox1 = 1 and textbox2 = jx.

Please Help me...
Best Regards

Jx_Man 987 Nearly a Senior Poster Featured Poster

i m a Normal...but my friends call me a bay window.

Jx_Man 987 Nearly a Senior Poster Featured Poster

my score is 3266
first try

Jx_Man 987 Nearly a Senior Poster Featured Poster

heii.. i got 826 point,,,

Jx_Man 987 Nearly a Senior Poster Featured Poster

nice one..

Jx_Man 987 Nearly a Senior Poster Featured Poster

i want to finish my graduate project (my mom always asked me when i will get the graduate) :) and get a good job as fast i can.

Jx_Man 987 Nearly a Senior Poster Featured Poster

hmmm. i already got a big one a few years ago, it was happened in my country and the point in my town... the earthquakes make all of building is collapse, thousands people died and many road broken and cracked.

Jx_Man 987 Nearly a Senior Poster Featured Poster


hope the best for all of you in everything you do and you can pass any challenge in next year.MERRY CHRISTMAS AND HAPPY NEW YEAR

Jx_Man 987 Nearly a Senior Poster Featured Poster

i got 636...

Jx_Man 987 Nearly a Senior Poster Featured Poster

yup, you cannot get the source code from msi except you add your source code too when you build setup program.

Dukane commented: thank you +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

hi dr_computer.
we finally discussed for you problem in your own post before.
you should saw your post about add image. in this post you asked about add flash too and we already answer that.
so, open your own link post.

OK.

Jx_Man 987 Nearly a Senior Poster Featured Poster

people smoking makes me irritated

yes i dont like too... i m always tried to avoid them but i cant do anything if they smoking on the bus.

Jx_Man 987 Nearly a Senior Poster Featured Poster

hi all,
my computer have a trouble now. when i played the game my computer get hang for a few times but this problem never happen before. after hang then i close the game, i got 800 x 600 screen resolution on my computer. sometimes it make me must to restart my pc cause my desktop cannot to access. why this can be happen?? any suggestion..:(

Jx_Man 987 Nearly a Senior Poster Featured Poster

768 beat that!

hhmm.. are this answer for Addicting little game post ?...

Jx_Man 987 Nearly a Senior Poster Featured Poster

576...

Jx_Man 987 Nearly a Senior Poster Featured Poster

411 now...:)

Jx_Man 987 Nearly a Senior Poster Featured Poster

380 but i didn't submit the high score...
play again...careful with the bounces.

Jx_Man 987 Nearly a Senior Poster Featured Poster

I love omelettes.

yup... i loved omelettes too and some milk...:)

Jx_Man 987 Nearly a Senior Poster Featured Poster

i choose a nice one. cause i hope in next year i can get anything more nice, good and be successful always.:)

Jx_Man 987 Nearly a Senior Poster Featured Poster

crysis
winning eleven 9
pro evolution 8
call of duty

Jx_Man 987 Nearly a Senior Poster Featured Poster

i ever has problem like this before but i use vb.net :
1. check the database name or report database path.
2. try to add the file that it need to using by crystal report.

OK.

Jx_Man 987 Nearly a Senior Poster Featured Poster

i use this code to specify the row which i use as key :

Dim i As Integer

 i = datagridName.CurrentRowIndex()

the code will get the row index, so you can use the index to get data in the row and use as key to show data in other datagrid.

this ex from me, you adapted with your own project :

"SELECT * FROM Users where Id_User ='" & Trim(datagridName.Item(i, 0)) & "'"

hope this helps.

Jx_Man 987 Nearly a Senior Poster Featured Poster

are you mean that when the row of datagrid selected then other datagrid will change agree with the selected point??
if my question is right one, you can use click event to do this. when datagrid is selected you will specify the row that you want to use as key to show a new data in other datagrid.

Jx_Man 987 Nearly a Senior Poster Featured Poster

hi jade_me..
sawamura already give the function u just add one function again to release capture.
try this following code :

Option Explicit

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Sub ReleaseCapture Lib "user32" ()

Const WM_NCLBUTTONDOWN = &HA1 'when left mouse button is clicked
Const HTCAPTION = 2 'signed that mouse is working on titlebar.

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        Call ReleaseCapture 'tell system through mouse didn't working anymore.
        'tell system through mouse already working on form.
        Call SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
    End If
End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        Call ReleaseCapture
        Call SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
    End If
End Sub

Private Sub Picture2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then 'if left mouse button working.
        If Picture2.BorderStyle = 1 Then
            Picture2.BorderStyle = 0
        Else
            Picture2.BorderStyle = 1
        End If
    End If
End Sub

oh yeah, picture1 is titlebar and picture2 is like exit sign.

ok. this all from me, you can change code as u needed.
all for the best

Naruse commented: Helps me much +1
november_pooh commented: viesta +1
Vega_Knight commented: works like charm +1
Estella commented: worked... +1
ITKnight commented: thx +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

hi sawamura,
i reply many code using api function this day.

if u want to snaphot u can use api function (PrintWindow and WindowFromPoint)
this a little sample to you. u can develop as u want..

Private Declare Function PrintWindow Lib "user32" (ByVal hwnd As Long, ByVal hdcBlt As Long, ByVal nFlags As Long) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Private Type POINTAPI
        x As Long
        y As Long
End Type

Dim lWFP As Long
Dim pt As POINTAPI

Private Sub Command1_Click()
    PrintWindow lWFP, Me.hDC, 0
End Sub

Private Sub Picture1_Click()
    Me.Picture1.AutoSize = True
End Sub

Private Sub Timer1_Timer()
    GetCursorPos pt
    lWFP = WindowFromPoint(pt.x, pt.y)
    Me.Caption = "Handle Window : " & Hex(lWFP)
End Sub

hope this code helps

Jx_Man 987 Nearly a Senior Poster Featured Poster

this api function :

private Declare function flashWindow Lib "user32" (ByVal hwnd as Long, ByVal bInvert as Long) As Long

add this code to timer1 :
FlashWindow Me.hwnd, 1

in this case i set timer interval = 500

hope this helps.
all for the best.

EkoX commented: Great to know this. but i don't know much about api function. +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

to play flash file u can use shockwave flash from com component.
To get this component you can see link from manal post.:)

this following code modified to open flash file :

Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
        With OpenFileDialog1
            '.InitialDirectory = "C:\"
            .Filter = "swf File|*.swf"
            .FilterIndex = 2
        End With

        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            AxShockwaveFlash1.Stop()
            AxShockwaveFlash1.Movie = OpenFileDialog1.FileName
            AxShockwaveFlash1.Play()
            lblFilePath.Text = OpenFileDialog1.FileName()
        End If
    End Sub

OK.
all For the best.

Jade_me commented: help me too +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

how about to use manifest file to make like xp, so it will work to all component.

Jx_Man 987 Nearly a Senior Poster Featured Poster

try this to open file image :

Private Sub btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn.Click
        With OpenFileDialog1
            '.InitialDirectory = "C:\"
            .Filter = "All Files|*.*|Bitmaps|*.bmp|GIFs|*.gif|JPEGs|*.jpg"
            .FilterIndex = 2
        End With

        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName)
            PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
            PictureBox1.BorderStyle = BorderStyle.Fixed3D
            lblFilePath.Text = OpenFileDialog1.FileName()
        End If
    End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

actually i used module to connect with access database :

Module ModUmum

    Public Function Koneksi() As OleDb.OleDbConnection
        Dim con As OleDb.OleDbConnection
        con = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath.ToString & "\yourdatabasename.mdb")
        Return con
        con = Nothing
    End Function

    Public bool As Boolean
    Public da As OleDb.OleDbDataAdapter
    Public dt As New DataTable
    Public i As Int16
    Public cmd As OleDb.OleDbCommand
    Public da1 As OleDb.OleDbDataAdapter
    Public strSQL As String
    Public CB As OleDb.OleDbCommandBuilder
    Public con = ModUmum.Koneksi

End Module

and i write my code like this

Try

        Dim connString As String
        Dim cmd As OleDb.OleDbCommand
        Dim KOneksi = ModUmum.Koneksi

       connString = "INSERT INTO Reservations (Transaction_Id, Item_Id, User_Id,Current_Date, Reserved_Until, Contact_Name, Contact_Tel)VALUES (trim(txtTransactionId.text), trim(txtItemId.text),trim(userid.text),dtpicker1.value.ToShortDateString, dtpicker2.value.ToShortDateString, trim(txtContactName.text),trim(txtContactTelp.text))"
               
                cmd = New OleDb.OleDbCommand(strSQL)
                cmd.Connection = con
                con.Open()
                cmd.ExecuteNonQuery()
                con.Close()

                 
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

ok. hope this help

Jx_Man 987 Nearly a Senior Poster Featured Poster

i will use shockwave flash.
find this control in component and check this.
it will showing in your toolbox, use like other and add this following code :
i use button here :

private sub command1_Click()
     shockwaveflash1.movie = yourFlashAppPath & "\yourFlashAppName
end sub

Ok.
all for the best

Elladan commented: hmmm ? +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

i used this to load from sqlserver 2000

Private Sub ReadData()
        Dim i As Integer
        Dim cmdUser As New SqlCommand
        Dim daUser As New SqlDataAdapter
        Dim dsUser As New DataSet
        Dim dtUser As New DataTable
        Dim conn As SqlConnection

        conn = GetConnect()
        Try

            cmdUser = conn.CreateCommand
            cmdUser.CommandText = "SELECT * FROM User"
            daUser.SelectCommand = cmdUser
            daUser.Fill(dsUser, "User")
            dtUser = dsUser.Tables("User")
            For i = 0 To dtUser.Rows.Count - 1
                cmbUserId.Items.Add(dtUser.Rows(i).Item(0))
            Next

        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Error conection!!")
        End Try
        conn.Close()
    End Sub

call this procedure when form load (form load event)

for note :
cmbUserId.Items.Add(dtUser.Rows(i).Item(0))
this code will adapted with your database, in mydatabase id user in item(0) / first coloumn

ok.
hope this help

Sawamura commented: thanks +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

you can use err object. this object was built in vb.net.
i will give a simple code for u
try this following code :

sub main()
10:       on error goto errHandling
20:       dim a as integer = 2
30:       dim b as integer = 7
40:       dim c as integer
50:       z = x / y
60:       console.writeline("Value of c : " & c)
70:       exit sub
errHandling:
                 dim ErrMsg as string
                 ErrMsg = "Error Number = " & err.number
                 ErrMsg = chr(13)
                 ErrMsg = "Error Description = " & err.Description
                 ErrMsg = chr(13)
                 ErrMsg = "Erorr Line = " & err.erl
                 msgbox(ErrMsg)
                 resume next
end sub

you can use err.clear to clear every err object property
err.source to show object name or application which error provides.

Ok.
all for the best

Naruse commented: not understand :( +1
Sawamura commented: Thx buddy +1
Jade_me commented: Perfectly +1