|
'----------------------------- كنترل هاي مورد استفاده
'-------------PageSetupDialog
'-------------PrintDocument
'-------------PrintPreviewDialog
'--------------------------------------------------------------
Private Sub MnItmPRINT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnItmPRINT.Click
If -DataSet-Name- .Rows.Count > 0 Then
CountLine = 0
NumberColumnsForPrint = -DataSet-Name- .Columns.Count
Titr = " جدول ..."
'-در اين صفحه متغيير هاي سراسري را كاربر تنظيم مي كند
'-مانند تعداد ستونها يا نوع خط جدول و ...
Dim OBJ As New PrintSettingPAGE()
OBJ.ShowDialog()
PageSetupDialog1.ShowDialog()
PrintPreviewDialog1.ShowDialog()
Else
MsgBox("اطلاعاتي براي پرينت وجود ندارد", MsgBoxStyle.OKOnly, "")
End If
End Sub
'------------------------------------------------------------------
'----------------------------- توابع مورد نياز پرينت ---------------
'------------------------------------------------------------------- Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
'----------------------------- متغير هاي سراسري استفاده شده-------------'-------------dim VerticalPAGE as Boolean افقي يا عمودي بودن صفحه
'-------------dim NumberColumnsForPrint as integer
'--------DirectionVertical تعداد ستونهاي ديتاست كه ميخواهيم چاپ كنيم
'-------------dim LinesPerPage as Integer تعداد خطهاي هر صفحه
'-------------dim Titr as String تيتر هر صفحه
'-------------------------------------------------------------- '''''''''''''''''''''''''''''''''''''''''
AxProgressBar2.Visible = True
AxProgressBar2.Value = 1
''''''''''''''''''''''''''''''''''''''''
Dim xCell As Integer
Dim yCell As Integer
Dim WidthCell As Integer
Dim xTITR As Integer
Dim yTITR As Integer
Dim HeightTITR As Integer
Dim WidthTITR As Integer
'--------------------------------------------------------------
'------------مقدار دهي اندازه ها و موقعيت سلول هاي جدول
'--------------------------------------------------------------
yTITR = CInt(PageSetupDialog1.PageSettings.Margins.Top)
xTITR = CInt(PageSetupDialog1.PageSettings.Margins.Left)
If PageSetupDialog1.PageSettings.Landscape = True Then
WidthTITR = CInt(PageSetupDialog1.PageSettings.PaperSize.Height) - (xTITR + CInt(PageSetupDialog1.PageSettings.Margins.Right))
Else
WidthTITR = CInt(PageSetupDialog1.PageSettings.PaperSize.Width) - (xTITR + CInt(PageSetupDialog1.PageSettings.Margins.Right))
End If
HeightTITR = 35
xCell = PageSetupDialog1.PageSettings.Margins.Left
yCell = yTITR + HeightTITR
WidthCell = CInt(WidthTITR \ NumberColumnsForPrint)
'--------------------------------------------------------------
'------------محاسبه تعداد خطهاي هر صفحه
Dim LinesPerPage As Integer
If PageSetupDialog1.PageSettings.Landscape = True Then
LinesPerPage = CInt((CInt(PageSetupDialog1.PageSettings.PaperSize.Width) - (yTITR + HeightTITR + HeightHeaderCell + CInt(PageSetupDialog1.PageSettings.Margins.Bottom))) \ HeightCell)
Else
LinesPerPage = CInt((CInt(PageSetupDialog1.PageSettings.PaperSize.Height) - (yTITR + HeightTITR + HeightHeaderCell + CInt(PageSetupDialog1.PageSettings.Margins.Bottom))) \ HeightCell)
End If
'---------------------------------------------------------------------- Dim RectF As RectangleF
If -DataSet-Name- .Rows.Count <> 0 Then
'----------------------------------------------------------
'------------ نوشتن متن تيتر
'---------------------------------------------------------- Dim StrForm As StringFormat
StrForm = New StringFormat(StringFormatFlags.DirectionRightToLeft)
StrForm.Alignment = StringAlignment.Center
StrForm.LineAlignment = StringAlignment.Center
RectF.X = xTITR ' xTITR = 15 or 790
RectF.Y = yTITR ' yTITR = 15 or 15
RectF.Height = HeightTITR ' HeightTITR = 25 or 25
RectF.Width = WidthTITR ' WidthTITR = 750 or 1140
e.Graphics.DrawString(Titr, TitrFont, Brushes.Black, RectF, StrForm)
'----------------------------------------------------------
'------------ نوشتن سطرها
'---------------------------------------------------------- RectF.X = xCell
RectF.Y = yCell + HeightHeaderCell
RectF.Width = WidthCell
RectF.Height = HeightCell
StrForm.Alignment = StringAlignment.Far
StrForm.LineAlignment = StringAlignment.Far
Dim PrintFont As New Font("Arial", 10)
PrintFont = DataGrid1.Font
Dim StrField As String '' براي دريافت فيلدهاي جدول
Dim counter As Integer '' شمارهنده
For I2 = 0 To LinesPerPage - 1
RectF.X = xCell
For I = (NumberColumnsForPrint - 1) To 0 Step -1
StrField = " " & CStr( -DataSet-Name- .Rows(CountLine).Item(I))
e.Graphics.DrawRectangle(PenRow, RectF.X, RectF.Y, RectF.Width, RectF.Height)
e.Graphics.DrawString(StrField, PrintFont, Brushes.Black, RectF, StrForm)
RectF.X += WidthCell
StrField = ""
Next
RectF.Y += HeightCell
CountLine += 1
If -DataSet-Name- .Rows.Count = CountLine Then
Exit For
End If
Next
'----------------------------------------------------------
'------------ كشيدن نام ستونها فقط 12 ستون
'---------------------------------------------------------- StrForm.Alignment = StringAlignment.Center
StrForm.LineAlignment = StringAlignment.Center
RectF.X = xCell
RectF.Y = yCell
RectF.Width = WidthCell
RectF.Height = HeightHeaderCell
PrintFont = DataGrid1.HeaderFont
For I = (NumberColumnsForPrint - 1) To 0 Step -1
StrField = CStr( -DataSet-Name- .Columns(I).ColumnName)
e.Graphics.DrawRectangle(PenColumn, RectF.X, RectF.Y, RectF.Width, RectF.Height)
e.Graphics.DrawString(StrField, PrintFont, Brushes.Black, RectF, StrForm)
RectF.X += WidthCell
StrField = ""
Next
End If
'--------------------------------------------------------------
'------------اگر تعداد خطها زياد شد بايد صفحه ديگر ايجاد شود
'------------در غير اين صورت صفحه جديد نبايد توليد شود
'-------------------------------------------------------------- If CountLine < -DataSet-Name- .Rows.Count Then
e.HasMorePages = True
Else
CountLine = 0
e.HasMorePages = False
End If
End Sub
|
|
|
|
|
Would you like to ask a particular question about this stuff??
Or do you normally just go around to forums and post random, yet long, sections of code for no particular reason?
|
|
|
|
|
Hey Guys, this I need to do hopefully you guys can help.
I just need an application or service to browse to a certain page every five minutes. In my case it will be an asp page. Once the services browses to the page it just needs to close the and the asp page takes it from there and starts producing a grid. For instance when it connects properly the grid will show some green, but say the service gets stopped or the computer or server goes down then the grid will start showing red.
I hope that all made sense, if not just let me know and i will try to give some more info. I am just hoping someone can help.
Thanks, Travis
|
|
|
|
|
You can use WebRequest class in System.Net to browse a web page. Pass a querystring that is unique to your calling application. When you execute WebRequest.GetResponse(), you can be sure that the application is trying to connect to the web page.
In the ASP page, check from the querystring if the connection request is from your calling application, if yes, do your color thing.
SG
|
|
|
|
|
Hey man,
I just wanted to say thanks alot for that little bit of information. By using the webrequest I got the results I was needing.
Thanks again,
Travis
|
|
|
|
|
if any one has the code that connect visual basic 6 with sql server 2000
plzz send me on my id jawad1_hassan1@hotmail.com
plzzz
|
|
|
|
|
I've got much better idea: Write it yourself.
When you get stuck at a certain point, then you can ask questions about the problem you're having. BTW, there is no "just do this" code that you can use to "connect" to an SQL, or any database, server. How you retrieve data from a database depends on what you want to do with the data and how the database is organized and even how your code is organized. There's lots of different ways to do this.
|
|
|
|
|
how to insert or save the entering values into msaccess from vb.net windows application?
|
|
|
|
|
http://www.google.com.au/search?hl=en&q=insert+save+access+vb.net&btnG=Search&meta=[^]
I trimmed a few words from your original question, but even the full question gave useful hits in google. We really can't offer anything more specific without knowing about your database, and you should read the generic stuff first.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
how to insert or save the entering values into msaccess from vb.net windows application?
|
|
|
|
|
if any one has the code that connect visual basic 6 with sql server 2000
plzz send me on my id jawad1_hassan1@hotmail.com
plzzz
|
|
|
|
|
how to insert or save the entering values into msaccess from vb.net windows application?
|
|
|
|
|
A simple google search[^] provides you with a lot of information.
Have a look at this article[^]
Do not spam the forums, delete your other duplicate messages.
|
|
|
|
|
i need a code that connect visual basic 6.0 with sql server 2000 urgently
so any bode that have the code
plzzz send it.
jawad
|
|
|
|
|
I am having a datagridview.
New records added in the datagridview(by entering values in the blank row shown at the end) are not shown after focus is moved out of the row.
Why the row added is not shown in the datagridview?
|
|
|
|
|
Hi,
I try to programming something that scale a Image or a bitmap in a way, that every pixel becoms a small rectangle. I can dou this with two loops in wich the color of a pixel can be read and then a rectangel can be drawn, but this works to slowly. Is there anyboady who can help me to program this in a fast way?
Thanks, Hans-Christian
|
|
|
|
|
Hi to all
<code><asp:RadioButtonList id="radioGross" runat="server" Width="193px" AutoPostBack="True" RepeatDirection="Horizontal">
<asp:ListItem Value="1">Gross</asp:ListItem>
<asp:ListItem Value="2">Net</asp:ListItem>
</asp:RadioButtonList></TD>
</code>
& also i am having a checkbox on form when i click this checkbox then
this radio buttons should be enabled. I make this radiogross disabled.on page load event
-- modified at 8:02 Wednesday 9th May, 2007
|
|
|
|
|
When you post this in the ASP.NET forum, check 'Ignore HTML tags in this message (good for code snippets)', and your post will make sense
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I have shelled a DOS command that gives me the list of projects in a particular server which goes like this.
Shell("c:\program files\ascential\datastage7.5\dsjob -server xx.xxx.xx.xx -user abcd -password xyz -lprojects")
If I run the above command in command prompt it will display the list of projects.
I need to get this result in a combobox or something of similar kind.
Can anybody help me on this ?
|
|
|
|
|
When you set up the process, you can tell it to redirect the output.
See this article[^] for details.
|
|
|
|
|
Hi,
Can we stop the dropdown listbox from appearing at all from a combobox? Can we set the listbox hwnd = 0? I know we could try to hide the dropdown via the dropdown event or via the windows message CNB_DROPDOWN.
|
|
|
|
|
You're talking about a textbox, aren't you ?
What does the combo give you if the arrow doesn't drop a list box ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
no i do mean the listbox. i want to use the look of the combobox but drop down my own list like a treeview... i have implemented it with a textbox and button and everything is fine except it doesn't theme. So, i thought if i use a standard combobox and have a textbox sit on top and somehow turn off the listbox, could get the themed look of the button.
|
|
|
|
|
Hi, I have a vb6 combobox on a usercontrol and subclassed this combobox to catch the CBN_DROPDOWN message and unfortunate this message never seems to occur. I tried doing the same thing on a vb form and that works. Can anyone help?
Friend Function WndProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim iCode As Long
Select Case uMsg
Case WM_COMMAND
If lParam <> 0 Then
iCode = (wParam And &HFFFF0000) \ &H10000
If iCode = CBN_DROPDOWN Then
SendMessage cbo.hwnd, CB_SHOWDROPDOWN, 0, 0
End If
End If
End Select
WndProc = CallWindowProc(m_OrigWndProc, hwnd, uMsg, wParam, lParam)
End Function
|
|
|
|
|
using System
using System.Collections
using System.Text
using System.Net.Sockets
using System.Net
namespace TrySocketLib;
{
Public Class MessEvent:System.EventArgs;
{
Public String mess;
}
Public delegate void MessageReceivedHandsler(Object sender,MessEvent evt)
Public Class ChatClient;
{
Private TcpClient myClient;
Private String clientIP;
Private byte[] data;
Private bool receivedNick;
Public event MessageReceivedHandler OnMessReceived;
Private static sortedLIST allClients=new sortedList();
Public ChatClient(TcpClient tcpC);
{
myClient=tcpC;
clientIP=tcpC.Client.RemoteEndPoint.ToString();
allClients.Add(clientIP,this);
data=new Byte[myClient.ReceiveBufferSize];
myClient.GetStream().BeginRead(data,0,myClient.ReceiveBufferSize,ReceiveMessage,null);
}
Public void AddMessReceivedRceivedHandler(MessageReceivedHandler handler );
{
onMessReceived+=handler;
Public void RemveMessReceivedHandler(MessageReceivedHandler handler);
{
onMessReceived-=handler;Public void SendMessage(string mess);
{
try
{
system.Net.Sockets.NetworkStream ns;
lock(myClient.GetStream())
{
ns=myClient.GetStream();
byte[] bytesToBeSent=System.Text.Encoding.ASCII.GetByte(mess);
ns.Write(bytesToBeSent,0,bytesToBeSent.Length);
ns.Flush();
}
}
catch(Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
Public void Broadcast(String messageReceived)
{
for(int i=0;i
|
|
|
|