Sorry Confused already delete fronm there
EngrImad
Posts
-
Update Parent and Child Table -
Update Parent and Child TableHello every one; the below Code is to update Parent and Child table, the relationship between tables was set to (Relation only) on Data Designer, But on SQL Server, Update and Delete Rule set to (Cascade) with this setup Parent table was Updating ok, but child table return (Added/Modified) changes as nothing and did not get update I tried all cases to Set (Update-Delete-Accept/Reject) relationship Rules On Dataset Designer but did not solve the issue Could advise what to do here thanks in advance
ParentTableBindingSource.EndEdit
Dim My_Parent_Modified As DataTable = DataSet1.ParentTable.GetChanges(DataRowState.Modified)
Dim My_Parent_Added As DataTable = DataSet1.ParentTable.GetChanges(DataRowState.Added)
Dim My_Parent_Deleted As DataTable = DataSet1.ParentTable.GetChanges(DataRowState.Deleted)If My_Parent_ Modified Is Nothing = False Then
'Some Coding here
End if
If My_Parent_ Added Is Nothing = False Then
'Some Coding here
End if
If My_Parent_Deleted Is Nothing = False Then
'Some Coding here
End if
DataSet1.ParentTable.AcceptChangesChildTableBindingSource.EndEdit
Dim My_Child_Modified As DataTable = DataSet1.ChildTable.GetChanges(DataRowState.Modified)
Dim My_Child_Added As DataTable = DataSet1.ChildTable.GetChanges(DataRowState.Added)
Dim My_Child_Deleted As DataTable = DataSet1.ChildTable.GetChanges(DataRowState.Deleted)If My_Child_ Modified Is Nothing = False Then
'Some Coding here
End if
If My_Child_ Added Is Nothing = False Then
'Some Coding here
End if
If My_Child_Deleted Is Nothing = False Then
'Some Coding here
End if
DataSet1.ChildTable.AcceptChangesImad
-
Raise Event on another FormHello everyone subject is declare event on Form1 , and run that event on Form2 here is the code , but event doesnt work on Form2 !! what is missing here?? many thanks
Public Class Form1
Private Sub btnOpenForm2\_Click(sender As Object, e As EventArgs) Handles btnOpenForm2.Click Form2.Show() End Sub Public Event show\_My\_Message() Private Sub btnShowMessageOnForm2\_Click(sender As Object, e As EventArgs) Handles btnShowMessageOnForm2.Click RaiseEvent show\_My\_Message() End Sub
End Class
Public Class Form2
Public WithEvents My\_Form1 As Form1 = New Form1 Private Sub Show\_My\_Message\_On\_Form2() Handles My\_Form1.show\_My\_Message MsgBox("Hello") End Sub
End Class
-
Get Process PercentageAnother Option here we could use "BackgroundWorker" as following:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ProgressBar1.Maximum = ???? Here what should put?
BackgroundWorker1.WorkerReportsProgress = True
BackgroundWorker1.RunWorkerAsync()
End SubPrivate Sub BackgroundWorker1\_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork 'We can measure this loop for example For t = 0 To myMax Label1.Text = t BackgroundWorker1.ReportProgress(t) Threading.Thread.Sleep(100) Next 'But we need to measure process percentage of (My\_Process()) , 'No have (t) digital counter to use in (BackgroundWorker1.ReportProgress(t)) 'So what is the solution here??? End Sub
Private Sub BackgroundWorker1_ProgressChanged(sender As Object, e As ProgressChangedEventArgs) Handles BackgroundWorker1.ProgressChanged
Label1.Text = e.ProgressPercentage.ToString() & " %"
ProgressBar1.Value = e.ProgressPercentage
ProgressBar1.Refresh()
End SubPrivate Sub My_Process()
---- Code
End Sub -
Get Process PercentageThanks sir for reply other option could we do the following: Private Sub My_Process() Timer1.Start ----Code ----Code Timer1.Stop End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick 'What we should do here to link progress bar to timer in Parallel ??? End Sub mean we shall measure the time for whole process then we need to link that time to ProgressBar to show where we are in process but here also must link the ProgressBar to timer in Parallel May be we can use threading start ProgressBar and TimerTick?? Does that Possible? If so, can show main function or code to achieve that?
-
Get Process PercentageHello How we can get the Percentage of any Process? for example we have the the following: Private Sub My_Process() ----Code ----Code End Sub this My_Process will have a lot of codes and process and may will take a time to finish Is there a way to measure the achievement percent of M_Process while process? thanks regards
-
DataGridView Multi Layer Headerthanks clear
-
DataGridView Multi Layer Headerthanks what about if want to attached file?
-
DataGridView Multi Layer HeaderHello I have Seen this Article: DataGridView – Stacked Header; talk about how to make Multi Layer head for DatagridView it was on C# , I have translated to VB.net but there was some errors, have made it before in VB.net ? I try to attach Source code of VB.net but I have'nt seen attachment option many thanks
-
How to BitConverter.GetBytes() return 2 digits onlyI solved like follows:-
Dim MyInt As Int16 = 12
Dim result (0) As Byte
result (0) = Convert.ToByte(MyInt)
Console.WriteLine(BitConverter.ToString(result))thanks everyone again
-
How to BitConverter.GetBytes() return 2 digits onlyHello every one simple code as follow
Dim MyInt As Int16 = 12
Dim result As Byte() =BitConverter.GetBytes(MyInt)
Console.WriteLine(BitConverter.ToString(result).Length)
Console.WriteLine(BitConverter.ToString(result))this will return as follow 5 0C-00 Just I want to get 2 0C (length 2 only) and return (0C) only I try to change "MyInt" Declare type from Int16 to all available types but did not work, also i dont need to subtract result as string, i need result as byte() type any advise please ? I am using VS2019 thanks in advance
-
Saving & Retrieving An ImageI have got same issue exactly, while retrieving image from Database to PitcureBox getting error saying that "Parameters is Not Valid", it is look like there is an issue when save the image and converted to string in DB, hope to have some solutions,
-
Save, Retrieve Image on SQL Database using VB.netHello; I have image on PictureBox, Cinverted to Base64String string and saved in Database as following: Dim ms As MemoryStream = New MemoryStream Dim bmp As Bitmap = New Bitmap(PictureBox1.Image) bmp.Save(ms, System.Drawing.Imaging.ImageFormat.jpg) Dim My_Photo_Str As String = Convert.ToBase64String(ms.ToArray) myqry = "update MYTABLE set COLUMN1=" & "'" & My_Photo_Str & "'" & "where COLUMN2=" & 50 mycmd = New OleDbCommand(myqry, conn) mycmd.CommandTimeout = 0 mydr = mycmd.ExecuteReader Now that image need to retrieve it or shows on PictureBox, So I used the following:- myqry = "select * from MYTABLE where COLUMN2=" & 50 mycmd = New OleDbCommand(myqry, conn) mycmd.CommandTimeout = 0 mydr = mycmd.ExecuteReader mydr.Read() Dim PIC As Byte() PIC = mydr("COLUMN1") Dim My_Photo = New MemoryStream(PIC) PictureBox1.Image = Bitmap.FromStream(My_Photo) <<<<<-----HERE GOT ERROR the error on last line while try to set image to PictureBox, and error said that cannot convert Byte() to image, If any help will so appreciated thanks
-
Fill Data of Parents and multi levels of Child tables onlyI would like to know how to fill the Parent table and multi different levels of child tables with data, mean the child tables will be filled with data relate to that Parent table only.. Example: Level 1 : GRANDFATHER table - Can be fill using Data Adapter Like: (DataAdapter.Fill(DataSet.DataTable,GRANDFATHER-ID) - {(GRANDFATHER-ID is Primary Key)} here i select specific record and fill and everything good Level 2 : Father table - Can be fill using Data Adapter Like:(DataAdapter.Fill(DataSet.DataTable, MYGRANDFATHER-ID) - {(MYGRANDFATHER-ID is Foreign Key)} mean here i can fill level 2 of child table because it is link to one record only from Parent table so I fill all fathers and one Grandfather, and still everything is good Level 3 : Kids table - Here we face problem!! , How to Fill Data Adapter using multi Fathers ID?? mean i want to fill all kids under multi fathers related to that Parent table of one GRANDFATHER only.. I don not like to fill all Kids Data under all Fathers and All Grandfathers, hopefully i found solution and clear what I mean...