|
Hi...
i am using VB 2005 for a project.
I have a panel which is having two images... On the load of image if they are bigger then the panel the scroll bar appears... This is working fine, but when i try to move the scroll bar (Only vertical in my case) by mouse “wheel scroll” it dose now works
Can please some one help me
Regards
Nishkarsh
|
|
|
|
|
hi
create a new class and implements/inherit a label.
in the new class override the OnMouseWheel methode.
regards
|
|
|
|
|
Hi JoeSharp
thanks for the suggestion
i am not that great in OOPS way... can you please send me a sample code
|
|
|
|
|
hi
a little example
Public Class MyControl
Inherits System.Windows.Forms.UserControl
Protected Overrides Sub OnMouseWheel(ByVal e As System.Windows.Forms.MouseEventArgs)
If e.Delta <> 0 Then 'has wheel been moved?
'The .NET docs suggest that e.Delta returns the actual number of notches
'the mouse wheel has been rotated, but in actuality each roll of the mouse wheel
'returns a value of +/- 120 (depending on the direction of rotation).
'120 is actually a system constant, and therefore there is a possibility that it could
'change to allow for higher-resolution mouse wheels.
'check out <http: msdn.microsoft.com="" library="" en-us="" winui="" windowsuserinterface="" userinput="" mouseinput="" mouseinputreference="" mouseinputmessages="" wm_mousewheel.asp="">
'for more information
Dim zoomIn As Boolean = (e.Delta < 0)
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
' Overriden Paint Methode
' Do your paint stuff in this methode, such as draw images or draw text
End Sub
End Class
regards
|
|
|
|
|
hi friends,
i have a win application , i want to block installtion of the same application from next time, (ie, if i uninstalled first & try to install the same application again, dont allow it to install). Also , i want to do the same for both Vb.net and Vb6 application..
Need help fast...
cheers..
|
|
|
|
|
Your best bet is to leave a file behind on uninstall which tells your app not to run, but I don't see how you can stop it installing.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
thanks to reply,
yes, i need to stop the installation from second time, i made a exe that will create a txt file in program files, if that file is there, then dont allow to install, but how can i execute that exe & how can i stop installation
cheers,,
|
|
|
|
|
There is a setup building utility called GNU setup... This utility as the name tels is under GNU license
One can create setup of single file/exe or can even run multiple setup... at a time... also it allows to write scripts to be written which will help u achieve what u want...
Good Luck
|
|
|
|
|
Hii ,
I am having some picturebox , in that i am adding some controls at runtime, now i want to save it into xml file . Now i am getting the control names in xml file .Presently , I amnot able to retrieve their properties into xml file. The xmlfile should look like this .I am using datatable .Just i want to save inorder of control and their properties .
the xml file should be like this
<Pages xmlns="">
- <Page PageNo="1">
<PageName>Page1</PageName>
<PageSize>3</PageSize>
<PageOrientation>0</PageOrientation>
<PagePicture />
<PageNoPicture>false</PageNoPicture>
<PageAllPages>false</PageAllPages>
<PageDesignOnly>false</PageDesignOnly>
- <PageBorder>
<BorderLeft>0.75</BorderLeft>
<BorderTop>0.75</BorderTop>
<BorderHeight>0.75</BorderHeight>
<BorderWidth>0.75</BorderWidth>
<BorderPattern>1</BorderPattern>
</PageBorder>
- <txt:TextBox TextIndex="1">
<txt:TextName>Text1</txt:TextName>
<txt:TextAlign>0</txt:TextAlign>
<txt:Appearance>1</txt:Appearance>
<txt:TextBackColor>-2147483643</txt:TextBackColor>
<txt:TextForeColor>-2147483640</txt:TextForeColor>
<txt:TextBorderStyle>1</txt:TextBorderStyle>
<txt:TextText>Text1</txt:TextText>
- <fn:Font>
<fn:FontName>MS Sans Serif</fn:FontName>
- <fn:FontStyle>
<fn:Bold>false</fn:Bold>
<fn:Italic>false</fn:Italic>
</fn:FontStyle>
<fn:FontSize>8</fn:FontSize>
<fn:FontUnderline>false</fn:FontUnderline>
<fn:FontStrikeout>false</fn:FontStrikeout>
</fn:Font>
<txt:TextToolTip />
- <pos:Position>
<pos:Left>1935</pos:Left>
<pos:Top>1560</pos:Top>
<pos:Height>315</pos:Height>
<pos:Width>1605</pos:Width>
</pos:Position>
<txt:TextLocked>false</txt:TextLocked>
<txt:TextMaxLen>255</txt:TextMaxLen>
<txt:TextMinLen>0</txt:TextMinLen>
<txt:TextMultiline>false</txt:TextMultiline>
<txt:TextDataType>0</txt:TextDataType>
<txt:TextFormat />
<txt:IsIndexField>True</txt:IsIndexField>
</txt:TextBox>
- <txt:TextBox TextIndex="2">
<txt:TextName>Text2</txt:TextName>
<txt:TextAlign>0</txt:TextAlign>
<txt:Appearance>1</txt:Appearance>
<txt:TextBackColor>-2147483643</txt:TextBackColor>
<txt:TextForeColor>-2147483640</txt:TextForeColor>
<txt:TextBorderStyle>1</txt:TextBorderStyle>
<txt:TextText>Text2</txt:TextText>
- <fn:Font>
<fn:FontName>MS Sans Serif</fn:FontName>
- <fn:FontStyle>
<fn:Bold>false</fn:Bold>
<fn:Italic>false</fn:Italic>
</fn:FontStyle>
<fn:FontSize>8</fn:FontSize>
<fn:FontUnderline>false</fn:FontUnderline>
<fn:FontStrikeout>false</fn:FontStrikeout>
</fn:Font>
<txt:TextToolTip />
- <pos:Position>
<pos:Left>1965</pos:Left>
<pos:Top>2085</pos:Top>
<pos:Height>315</pos:Height>
<pos:Width>1605</pos:Width>
</pos:Position>
<txt:TextLocked>false</txt:TextLocked>
<txt:TextMaxLen>255</txt:TextMaxLen>
<txt:TextMinLen>0</txt:TextMinLen>
<txt:TextMultiline>false</txt:TextMultiline>
<txt:TextDataType>0</txt:TextDataType>
<txt:TextFormat />
<txt:IsIndexField>False</txt:IsIndexField>
</txt:TextBox>
- <txt:TextBox TextIndex="3">
<txt:TextName>Text3</txt:TextName>
<txt:TextAlign>0</txt:TextAlign>
<txt:Appearance>1</txt:Appearance>
<txt:TextBackColor>-2147483643</txt:TextBackColor>
<txt:TextForeColor>-2147483640</txt:TextForeColor>
<txt:TextBorderStyle>1</txt:TextBorderStyle>
<txt:TextText>Text3</txt:TextText>
- <fn:Font>
<fn:FontName>MS Sans Serif</fn:FontName>
- <fn:FontStyle>
<fn:Bold>false</fn:Bold>
<fn:Italic>false</fn:Italic>
</fn:FontStyle>
<fn:FontSize>8</fn:FontSize>
<fn:FontUnderline>false</fn:FontUnderline>
<fn:FontStrikeout>false</fn:FontStrikeout>
</fn:Font>
<txt:TextToolTip />
- <pos:Position>
<pos:Left>2925</pos:Left>
<pos:Top>4935</pos:Top>
<pos:Height>315</pos:Height>
<pos:Width>1605</pos:Width>
</pos:Position>
<txt:TextLocked>false</txt:TextLocked>
<txt:TextMaxLen>255</txt:TextMaxLen>
<txt:TextMinLen>0</txt:TextMinLen>
<txt:TextMultiline>false</txt:TextMultiline>
<txt:TextDataType>0</txt:TextDataType>
<txt:TextFormat />
<txt:IsIndexField>True</txt:IsIndexField>
</txt:TextBox>
- <chk:CheckBox ChkBoxIndex="1">
<chk:ChkBoxName>Checkbox1</chk:ChkBoxName>
<chk:ChkBoxAlign>0</chk:ChkBoxAlign>
<chk:ChkBoxAppearance>1</chk:ChkBoxAppearance>
<chk:ChkBoxBackColor>16777215</chk:ChkBoxBackColor>
<chk:ChkBoxCaption>Checkbox1</chk:ChkBoxCaption>
- <fn:Font>
<fn:FontName>MS Sans Serif</fn:FontName>
- <fn:FontStyle>
<fn:Bold>false</fn:Bold>
<fn:Italic>false</fn:Italic>
</fn:FontStyle>
<fn:FontSize>8</fn:FontSize>
<fn:FontUnderline>false</fn:FontUnderline>
<fn:FontStrikeout>false</fn:FontStrikeout>
</fn:Font>
<chk:ChkBoxForeColor>-2147483630</chk:ChkBoxForeColor>
- <pos:Position>
<pos:Left>2280</pos:Left>
<pos:Top>3180</pos:Top>
<pos:Height>285</pos:Height>
<pos:Width>1395</pos:Width>
</pos:Position>
<chk:ChkBoxToolTip />
<chk:ChkBoxDefaultValue>false</chk:ChkBoxDefaultValue>
</chk:CheckBox>
</Page>
</Pages>
</Name>
Every property of control from propertygrid or in some way . When i read the xml file it should display all the controls in the way it look previously .
DVSRIRAM
-- modified at 5:51 Wednesday 3rd October, 2007
|
|
|
|
|
look into 'serialisation'
it isn't easy but it will do what you want
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
I already told you, you have to write your own serializer since Control's are not serializable themselves. You'd probably user Reflection to pick out the Properties you want and ignore others. This is NOT an easy thing to do and is NOT for someone who's a beginner to tackle. This requires knowledge of Reflection and XML document generation.
The PropertyGrid will NOT do this for you.
|
|
|
|
|
Thanks For Replying ,
Hi , now i am using my own custom propertygrid for runtime controls when i am clicking on textbox it is showing properties . I am showing font,backcolor,location ,like some properties
1) How to create the wordwrap,TextAlign properties .
2) Now the problem arises with borderstyle ,Multiline and some other Properties while selecting textbox, I am not able to set these properties .These are not there by default for runtime ctr.I created the properties for borderstyle,. I dont know how to create the property for TextAlign . NOt Coming with (System.Win.Forms.TextboxBase)
3) In PropertyGrid1_PropertyValueChanged , i am writing like this
Case "Font"<br />
ctr.Font = e.ChangedItem.Value<br />
Select Case e.ChangedItem.Label<br />
<br />
Case "BackColor"<br />
ctr.BackColor = e.ChangedItem.Value<br />
<br />
Case "BorderStyle"<br />
if ctype(sender,TextBox) then '''Borderstyle not coming <br />
ctr.BorderStyle( Not Coming) = e.ChangedItem.Value <br />
<br />
Dim ctr As New TextBox ''If i use like this only borderstyle is coming "<br />
ctr.BorderStyle( Coming) = e.ChangedItem.Value ' but Not working <br />
waiting For Reply ......
DVSriram
|
|
|
|
|
i have created a windows service project and a deployment project to deploy the service.
i use the setup.exe created to install the service. The service installs fine and appears in services in control panel. but when i right click and start the service i get an error message 'could not start the service1 service on the local computer.
the service did not return an error. this could be an internal windows error or an internal service error.'
so then i tried running the service from program files and i get another error message saying 'cannot start the service from a command line or debugger. a windows services must first be installed (using installutil.exe) and then started with the server explorer or windows servce administrative tool.
is there anything i need to change to get this to work.
|
|
|
|
|
What does the code look like in your OnStart event??
You SHOULD be starting a new thread that does the work of the service. If all of your code is in the OnStart event, your code hasn't finished before the Service Manager times out and considers your service as failed.
|
|
|
|
|
i first wrote the code for the service in a simple windows app to test it and it worked fine and then copied it over to the service. in the app the code was run when a button was clicked. in the service the the code is run in OnStart.
|
|
|
|
|
There's you're problem. You cannot do that. OnStart is expected to return control back to the Service Manager within 30 seconds. Your code won't do that.
You MUST start a new thread that your service code runs under so the OnStart method can return control back to the Service Manager. This is going to require you to rewrite your code for a threaded environment.
|
|
|
|
|
I have a problem on the below random codes. The codes are actually working. But sometime it just hang after clicked on the randomise button. (I suspect it kept looping at (while loop) to search for random number. Can it be??)Can anyone help me? Here are my codes.
Private oQuestionCount As Integer = 5
Private sQuestionCount As Integer = 2
Dim tQuestion As Integer = ds.Tables("FilteredQuestion").Rows.Count
Dim aSize As Integer
If Me.cbQuesType.Text = "Obj" Then
aSize = oQuestionCount
Else
aSize = sQuestionCount
End If
If tQuestion = 0 And tQuestion < aSize Then
MessageBox.Show("The questions from the Question Bank is not enough")
Me.Dispose()
End If
Dim rnd = New Random
Dim irnd As Integer
Dim arnd(aSize - 1) As Integer
Dim aID(aSize - 1) As Integer
Dim i As Integer
Dim sID As String
Dim iStudentCount As Integer
Randomize()
For i = 0 To aSize - 1
irnd = rnd.Next(0, tQuestion - 1)
Do While Array.IndexOf(arnd, irnd) > -1
irnd = rnd.next(0, aSize - 1)
Loop
arnd(i) = irnd
aID(i) = ds.Tables("FilteredQuestion").Rows(irnd)(0)
If i = aSize - 1 Then
sID = sID & aID(i)
Else
sID = sID & aID(i) & ","
End If
Next
Thanks ....
|
|
|
|
|
Your name is not an intelligent subject, please try to choose one that makes sense. It helps people know if they can help you.
This looks like a mess. What are you trying to do ? Have you tried breaking into your code when it hangs to see what is going wrong ?
Christian Graus - Microsoft MVP - C++
"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 Christian Graus,
Thanks for the comment on the subject. I had changed it.
Yes, i tried to break the code and found out that it kept looping in the (while loop) to search for numbers i guess.
Actually what i'm trying to do is to retrieve random question from a table. This is a exam. paper program. So the student will login their ID to sit for exam. This program is to retrieve random question so that every student will not get the same quetion. This is my first time writing code for randomise. No idea what went wrong. Can you advice me? thanks in advance.
|
|
|
|
|
Hi.
I opened a VB .NET project with Visual Studio 2005. I have had limited contact with VB in the past and I'm not very comfortable using it.
My question:
Doesn't VS 2005 have a refractor for VB .NET??
I wanted to rename a method with (CTRL+R,R) just like I do in C# and VS says "The key combination (CTRL+R,R) is bound to a command(&Rename) which is not currently available".
And the menu Refractor, which in C# is between "View" and "Project" doesn't exist as well...
|
|
|
|
|
The keyboard shortcuts are probably different, but refactor should be on the right click menu ?
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
As opposed to C#, where there's the Refractor group with "Rename", "Extract method", etc, in VB there's only a single option called Rename, which brings up a "Rename" dialog. But it is simpler than the standard one of Refractor, more precisely it doesn't have any options (preview, search in comments & search in strings)
|
|
|
|
|
hai to all
i am working only vb .net,i val;i validate the text box only numbers & Only characters,so not support the platform keypress event and click event,pls give me a solution
Rathi
|
|
|
|
|
Ursrathi wrote: so not support the platform keypress event and click event,pls give me a solution
I don't understand ? The Textbox DOES support the keypress event.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
I have checked the events of TextBox. It does support KeyPress event. Can you recheck at your end.
You can use the following code for validation on a TextBox.
<br />
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress<br />
<br />
Select Case (Asc(e.KeyChar))<br />
<br />
Case 8, 48 To 57, 65 To 91, 96 To 122<br />
<br />
e.Handled = False<br />
<br />
Case Else<br />
<br />
e.Handled = True<br />
<br />
End Select<br />
<br />
End Sub<br />
Allen Smith
Software Engineer
ComponentOne LLC
www.componentone.com
|
|
|
|