|
Since every printer has different unprintable margins, it's impossible to have a single form layout that works for every printer.
In a Windows Forms app, you have to have some method to be able to move the fields around. A .config or .INI file works great for this. Then all you do is print a test form, and have the user modify the config file, either by hand or by using a utility you write, to tell your app to move the printed form in whatever direction is needed.
In a web form, since browsers render things slightly differently this is virtually impossible to do. I'm sure there might be a JavaScript way to do it, but that's not for this forum.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a database with two columns, "department_name" and a "color". My goal is to display a list of all of the values but formatted so as to display a rectangular swatch of the color and have the name follow it. I have absolutely no idea how to do this (new to VB.NET programming, ASP/ASP.net background), and would really appreciate some feedback. If anyone has used Adobe InDesign, they've seen something similar to what I am looking for when invoking a pantone color. You simply get a scrollable list with a rectangular swatch of the color followed by the color name. Any help or direction would be greatly appreciated!
|
|
|
|
|
I think you would need to add a custom control with the swatches to the listview. I have seen code to do this, I think on this site, but I am afraid I don't have a link. You might try searching for how to add a propgress bar to a listview control or something like that.
|
|
|
|
|
i wana close the main form that is loaded , after that i enter another form .
how can i do it ? when i wana close that main form all the forms go down ..
thxx
|
|
|
|
|
You can't! If you close the startup form of your project, then the whole thing goes down. This is because you just closed your application's message pump.
You'll have to redesign your app around this. Try searching the articles for "splash screen" screen for examples.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I thought that in .net it didn't work that way..off a post I saw about finding out how a form is closed, but I cuold be wrong. How about using a Main sub in a module to launch the form? May be a possible work around...have to play with that one.
|
|
|
|
|
hi
i saw your problem and as Dave said maybe you close the startup form
and say you want to make a splash screen ? if you want say about it and i'll write you a sample program about this.
with best wishes
smart_sdr
|
|
|
|
|
It works that way in ALL Windows applications. There is always a parent form that gets executed and becomes an application-level message loop. And yes, you can have a Sub Main that executes, using Application.Run( Form ) , that will start your app's application message pump.
Now, there's nothing that say you only have to have one Application.Run statement. Just search the Articles for "Splash Screen" and you'll see what I mean.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hellow to all ...
i am making a drawing program that contain basic drawing options ...
i have a problem when i wana save the photo that it is a pictuerbox it erased !
anyidea !
|
|
|
|
|
Without seeing your save code, it's impossible to tell you what you did wrong!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dim sFileName As String
Dim oFormat As System.Drawing.Imaging.ImageFormat
If SaveFileDialog1.ShowDialog = DialogResult.OK Then
sFileName = SaveFileDialog1.FileName
oFormat = System.Drawing.Imaging.ImageFormat.Bmp
Me.PictureBox1.Image.Save(sFileName, oFormat)
|
|
|
|
|
What are you drawing on? If your just getting the Graphics objects for the picturebox control, you're not drawing on this image that your trying to save. You're drawing on the surface of the control.
You should be getting the graphics object of the Image, not the control.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i repeated this question again, i wrote it in the SQL / ADO / ADO.NET (Programming Forums).
I'm reading a book "Network Programming in .Net with C# and Visual Basic.Net" by Fiach Reid
im now in the chapter 3 "Working with the sockets"
and im trying to execute the program that's starting at the page 82
and i received an error.Then i put a breakpoint to see what's the problem
then i saw that the problem happened in the Sub "acceptHandler" and this is the snippet code :
Public Sub acceptHandler(ByVal asyncResult As IAsyncResult)
receiveCallBack = New AsyncCallback(AddressOf receiveHandler)
'listenerSocket here = Nothing and i don't know why ?
clientSocket = listenerSocket.EndAccept(asyncResult)
recv = New Byte(1) {}
clientSocket.BeginReceive(recv, 0, 1, _
SocketFlags.None, receiveCallBack, Nothing)
End Sub
i don't know why listenerSocket in this code = Nothing
so this is the problem.
Smart_sdr
|
|
|
|
|
You're going to have to follow the code and find out where listenerSocket is defined and where it's being assigned an object. Since I don't have the book, I can't possibly tell you what you did wrong.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks to you Dave for your response.
I'll put the code here :
you put textbox and name it "tbStatus"
and put a button and name it "btnListen"
and this is the code as its from the book
after you run the program open the command prompt and write :
telnet "your ip address" 8080
and then the program will enter the sub "acceptHandler" and it will and
error cause the listenerSocket = Nothing
-------------------------- code ----------------
Imports System.Text
Imports System.Net.Sockets
Imports System.Net
Public Class Form1
Inherits System.Windows.Forms.Form
" Windows Form Designer generated code "
Private acceptCallBack As AsyncCallback
Private receiveCallBack As AsyncCallback
Public listenerSocket As Socket
Public clientSocket As Socket
Public recv() As Byte
Public Sub acceptHandler(ByVal asyncResult As IAsyncResult)
receiveCallBack = New AsyncCallback(AddressOf receiveHandler)
clientSocket = listenerSocket.EndAccept(asyncResult)
recv = New Byte(1) {}
clientSocket.BeginReceive(recv, 0, 1, _
SocketFlags.None, receiveCallBack, Nothing)
End Sub
Public Sub receiveHandler(ByVal asyncResult As _
IAsyncResult)
Dim bytesReceived As Integer = 0
bytesReceived = clientSocket.EndReceive(asyncResult)
If bytesReceived <> 0 Then
tbStatus.Text += Encoding.UTF8.GetString(recv)
recv = New Byte(1) {}
clientSocket.BeginReceive(recv, 0, 1, _
SocketFlags.None, receiveCallBack, Nothing)
End If
End Sub
Private Sub btnListen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnListen.Click
acceptCallBack = New AsyncCallback(AddressOf _
acceptHandler)
Dim listenerSocket As Socket = New Socket( _
AddressFamily.InterNetwork, _
SocketType.Stream, _
ProtocolType.Tcp _
)
Dim IPHost As IPHostEntry = _
Dns.GetHostByName(Dns.GetHostName())
Dim ipepServer As IPEndPoint = New _
IPEndPoint(IPHost.AddressList(0), 8080)
listenerSocket.Bind(ipepServer)
listenerSocket.Listen(-1)
listenerSocket.BeginAccept(acceptCallBack, Nothing)
End Sub
End Class
---------------------------- end of code ------------------
with best wishes
smart_sdr
|
|
|
|
|
I don't see anything much wrong with the code, but there are two things...
1) This may seem stupid, but did you click on the Listen button to start your listener before your tried to connect to it with "telnet whatever 8080"?
2) smart_sdr wrote:
Dim IPHost As IPHostEntry = _
Dns.GetHostByName(Dns.GetHostName())
Dim ipepServer As IPEndPoint = New _
IPEndPoint(IPHost.AddressList(0), 8080)
Did IPHost.AddressList(0) return an address? Stop the code on this line and use the debugger to check to values in IPHost .
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave,
about IPHost.Address(0), sure it contains a value,
also the code will execute :
listenerSocket.BeginAccept(acceptCallBack, Nothing)
will wait at the port 8080 and will enter "acceptHandler"
when you execute "telnet "your ip address" 8080"
and then you will find that listenerSocket=Nothing !
i put a breakpoint at the statement :
clientSocket = listenerSocket.EndAccept(asyncResult) ' in the Sub "acceptHandler"
and thanks for your response
with best wishes
smart_sdr
|
|
|
|
|
I didn't see this before, but the problem is because you're not assigning a new object to your class-level listenerSocket . You're defining a new, local one and it's dropping out of scope at then end of this sub:
Private Sub btnListen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnListen.Click
acceptCallBack = New AsyncCallback(AddressOf _
acceptHandler)
Dim listenerSocket As Socket = New Socket( _
AddressFamily.InterNetwork, _
SocketType.Stream, _
ProtocolType.Tcp _
)
Remove the Dim from the listenerSocket line:
listenerSocket As Socket = New Socket( _
AddressFamily.InterNetwork, _
SocketType.Stream, _
ProtocolType.Tcp _
)
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks Dave for your attention
maybe i was sleeping and i didn't pay attention to this thing.
thanks again
smart_sdr
|
|
|
|
|
Dave if you don't have a book i can send it to you by e-mail.
if you want.
smart_sdr
|
|
|
|
|
Hai...
I need TO SPLIT THE wave file, how to do that using vb. Please let me know.
Thanks,
E.Veera Raghavendra
|
|
|
|
|
Veera,
I'll try to help you but..
What do you mean by "split the wave file"?
Do you want to edit it? .. Or get a section of it? ... or what?
progload
|
|
|
|
|
If the wave file is large i want to divide into sections and to be read the section.
Thanks,
E.Veera Raghavendra.
|
|
|
|
|
|
Hai..
It is not helpful to me needs. Presently I am able to play the wave file and displaying the wave signal. But if the wav file is large, tkaing time to load. So i need to read some part of the file each time.
thanking you,
E.Veera Raghavendra.
|
|
|
|