- Open a New Web project in Visual Studio
- Create two New
WebForm pages named ParentWebForm and ChildWebForm
- Open the HTML surface for the
ParentWebForm
- Locate the yellow line
- Delete all code EXCEPT the yellow line
- Insert the following HTML below the existing yellow line
Collapse<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Parent Webform</title>
<script language="javascript">
function OpenChild()
{
var ParmA = retvalA.value;
var ParmB = retvalB.value;
var ParmC = retvalC.value;
var MyArgs = new Array(ParmA, ParmB, ParmC);
var WinSettings = "center:yes;resizable:no;dialogHeight:300px"
var MyArgs = window.showModalDialog(
"http://localhost/ModalWin/ChildWebForm.aspx", MyArgs, WinSettings);
if (MyArgs == null)
{
window.alert(
"Nothing returned from child. No changes made to input boxes")
}
else
{
retvalA.value=MyArgs[0].toString();
retvalB.value=MyArgs[1].toString();
retvalC.value=MyArgs[2].toString();
}
}
</script>
</HEAD>
<body>
<P><INPUT id="retvalA" type="text" value="AAA"></P>
<P><INPUT id="retvalB" type="text" value="BBB"></P>
<P><INPUT id="retvalC" type="text" value="CCC"></P>
<P><BUTTON onclick="OpenChild()" type="button">
Open Child Window</BUTTON>
</P>
</body>
</HTML>
- In the above code, locate the line saying //ALTER BELOW LINE
- Supply the correct URL for your
ChildWebform
- Open the HTML surface for the
ChildWebForm
- Locate the yellow line
- Delete all code EXCEPT the yellow line
- Insert the following HTML below the existing yellow line
Collapse<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Child Webform</TITLE>
<script language="javascript">
function Done() {
var ParmA = tbParamA.value;
var ParmB = tbParamB.value;
var ParmC = tbParamC.value;
var MyArgs = new Array(ParmA, ParmB, ParmC);
window.returnValue = MyArgs;
window.close();
}
function doInit() {
var ParmA = "Aparm";
var ParmB = "Bparm";
var ParmC = "Cparm";
var MyArgs = new Array(ParmA, ParmB, ParmC);
MyArgs = window.dialogArguments;
tbParamA.value = MyArgs[0].toString();
tbParamB.value = MyArgs[1].toString();
tbParamC.value = MyArgs[2].toString();
}
</script>
</HEAD>
<BODY onload="doInit()">
<P>Param A:<INPUT id="tbParamA" TYPE="text"></P>
<P>Param B:<INPUT ID="tbParamB" TYPE="text"></P>
<P>Param C:<INPUT ID="tbParamC" TYPE="text"></P>
<BUTTON onclick="Done()" type="button">OK</BUTTON>
</BODY>
</HTML>
- Set the project StartUp page to be the Parent Webform
- Run the project.
Note
To make the child modal to the entire desktop, you'll need add code to the child which uses <body onblur="this.focus">.
Source :
Private Sub CetakData()Dim cn As New SqlClient.SqlConnection("Integrated Security=False;Data Source=srv;Initial Catalog=tbl;User ID=user;Password=pwd;")Dim strsql As String
Sub CetakData()Dim cn As New SqlClient.SqlConnection("Integrated Security=False;Data Source=srv;Initial Catalog=tbl;User ID=user;Password=pwd;")Dim strsql As String
Dim cn As New SqlClient.SqlConnection("Integrated Security=False;Data Source=srv;Initial Catalog=tbl;User ID=user;Password=pwd;")Dim strsql As String
Dim strsql As StringDim ds As New dsLineSheetDim getImage As New clsGetImageDatacn.Open()
strsql = "Select ItemID,ItemCode,ItemSize,Status,LastStatusDate,SalesGroup,SalesGroupDate,Market,Collection,CollectionDesc,ShortDesc,RetailPrice,WSPrice,comp_name from vwLineSheet where comp_name = host_name()"
Dim ds As New dsLineSheetDim getImage As New clsGetImageDatacn.Open()
strsql = "Select ItemID,ItemCode,ItemSize,Status,LastStatusDate,SalesGroup,SalesGroupDate,Market,Collection,CollectionDesc,ShortDesc,RetailPrice,WSPrice,comp_name from vwLineSheet where comp_name = host_name()"
Dim getImage As New clsGetImageDatacn.Open()
strsql = "Select ItemID,ItemCode,ItemSize,Status,LastStatusDate,SalesGroup,SalesGroupDate,Market,Collection,CollectionDesc,ShortDesc,RetailPrice,WSPrice,comp_name from vwLineSheet where comp_name = host_name()"
"Select ItemID,ItemCode,ItemSize,Status,LastStatusDate,SalesGroup,SalesGroupDate,Market,Collection,CollectionDesc,ShortDesc,RetailPrice,WSPrice,comp_name from vwLineSheet where comp_name = host_name()"Dim dr As SqlClient.SqlDataReaderDim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(strsql, cn)Dim drw As DataRowDim i As Integer = 0dr = cmd.ExecuteReader
ds.Tables("vwLineSheet").Clear()Do
Dim dr As SqlClient.SqlDataReaderDim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(strsql, cn)Dim drw As DataRowDim i As Integer = 0dr = cmd.ExecuteReader
ds.Tables("vwLineSheet").Clear()Do
Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(strsql, cn)Dim drw As DataRowDim i As Integer = 0dr = cmd.ExecuteReader
ds.Tables("vwLineSheet").Clear()Do
Dim drw As DataRowDim i As Integer = 0dr = cmd.ExecuteReader
ds.Tables("vwLineSheet").Clear()Do
Dim i As Integer = 0dr = cmd.ExecuteReader
ds.Tables("vwLineSheet").Clear()Do
"vwLineSheet").Clear()Do
DoDo Until dr.Read = False
Do Until dr.Read = Falsedrw = ds.Tables("vwLineSheet").NewRow()For i = 0 To dr.FieldCount - 1drw(i) = dr(i)
Next
"vwLineSheet").NewRow()For i = 0 To dr.FieldCount - 1drw(i) = dr(i)
Next
For i = 0 To dr.FieldCount - 1drw(i) = dr(i)
Next
NextTry
Trydrw(dr.FieldCount) = getImage.GetImageData("Images\" & ds.Tables("vwLineSheet").Rows(0)("ItemCode") & ".jpg")Catch ex As Exceptiondrw(dr.FieldCount) = getImage.GetImageData("\Images\na.jpg")End Try
"Images\" & ds.Tables("vwLineSheet").Rows(0)("ItemCode") & ".jpg")Catch ex As Exceptiondrw(dr.FieldCount) = getImage.GetImageData("\Images\na.jpg")End Try
Catch ex As Exceptiondrw(dr.FieldCount) = getImage.GetImageData("\Images\na.jpg")End Try
"\Images\na.jpg")End Try
End Tryds.Tables("vwLineSheet").Rows.Add(drw)Loop
"vwLineSheet").Rows.Add(drw)Loop
LoopLoop While dr.NextResult = True
Loop While dr.NextResult = TrueIf Me.rbGroup.Checked = True Then
If Me.rbGroup.Checked = True ThenMe.rptLineSheet_Group1.SetDataSource(ds)Me.CrystalReportViewer1.ReportSource = rptLineSheet_Group1Else
Me.rptLineSheet_Group1.SetDataSource(ds)Me.CrystalReportViewer1.ReportSource = rptLineSheet_Group1Else
Me.CrystalReportViewer1.ReportSource = rptLineSheet_Group1Else
ElseMe.rptLineSheet1.SetDataSource(ds)Me.CrystalReportViewer1.ReportSource = rptLineSheet1End If
Me.rptLineSheet1.SetDataSource(ds)Me.CrystalReportViewer1.ReportSource = rptLineSheet1End If
Me.CrystalReportViewer1.ReportSource = rptLineSheet1End If
End Ifdr.Close()
cmd.Dispose()
cn.Close()
End Sub
End Sub
Public Class clsGetImageDataPublic Function GetImageData(ByVal fileName As String) As Byte()Dim hasil As Byte()'Method to load an image from disk and return it as a bytestream
Class clsGetImageDataPublic Function GetImageData(ByVal fileName As String) As Byte()Dim hasil As Byte()'Method to load an image from disk and return it as a bytestream
Public Function GetImageData(ByVal fileName As String) As Byte()Dim hasil As Byte()'Method to load an image from disk and return it as a bytestream
Dim hasil As Byte()'Method to load an image from disk and return it as a bytestream
'Method to load an image from disk and return it as a bytestream If System.IO.File.Exists(fileName) = False Then
If System.IO.File.Exists(fileName) = False ThenfileName = "\\192.168.1.1\Images\na.jpg"
"\\192.168.1.1\Images\na.jpg"End If
End If'HttpContext.Current.Response.Write(fileName)
'HttpContext.Current.Response.Write(fileName)Dim fs As System.IO.FileStream = _New System.IO.FileStream(fileName, _System.IO.FileMode.Open, IO.FileAccess.Read)
Dim br As System.IO.BinaryReader = New System.IO.BinaryReader(fs)hasil = br.ReadBytes(Convert.ToInt32(br.BaseStream.Length))
fs.Dispose()
fs.Close()
br.Close()
Return hasilEnd FunctionEnd Class
Dim fs As System.IO.FileStream = _New System.IO.FileStream(fileName, _System.IO.FileMode.Open, IO.FileAccess.Read)
Dim br As System.IO.BinaryReader = New System.IO.BinaryReader(fs)hasil = br.ReadBytes(Convert.ToInt32(br.BaseStream.Length))
fs.Dispose()
fs.Close()
br.Close()
Return hasilEnd FunctionEnd Class
New System.IO.FileStream(fileName, _System.IO.FileMode.Open, IO.FileAccess.Read)
Dim br As System.IO.BinaryReader = New System.IO.BinaryReader(fs)hasil = br.ReadBytes(Convert.ToInt32(br.BaseStream.Length))
fs.Dispose()
fs.Close()
br.Close()
Return hasilEnd FunctionEnd Class
Dim br As System.IO.BinaryReader = New System.IO.BinaryReader(fs)hasil = br.ReadBytes(Convert.ToInt32(br.BaseStream.Length))
fs.Dispose()
fs.Close()
br.Close()
Return hasilEnd FunctionEnd Class
Return hasilEnd FunctionEnd Class
End FunctionEnd Class
Class
<asp:RegularExpressionValidator runat="server" ErrorMessage="Only picture files are allowed!" ValidationExpression="^(([a-zA-Z]:)|(
\\{2}\w+)\$?)(\\(\w[\w].*))+(.gif|.GIF|.jpg|.JPG|.jpeg|.JPEG)$" ControlToValidate="fileUpload" Display="None"></asp:RegularExpressionValidator>
Private Sub Timer1_Timer()
On Error GoTo salah
MsgBox "Please, close your application..." & vbCrLf & _
"Klick OK if you have done it....", vbExclamation
Shell "cmd.exe /c copy sourceFile destinationFile", vbHide
Timer1.Enabled = False
MsgBox "Program Updated"
Unload Me
Exit Sub
salah:
MsgBox Err.Description
Unload Me
End Sub
Add : please see copy command parameter for details.