vs2015html修改无效,代码生成期间遇到VS2015错误,更改未提交给源

First off, I wish I had more information to give you but I am kinda puzzled with this error from Microsoft Visual Studio 2015:

"An error was encountered during code generation. The changes you have made in the designer have not been committed to the source code. It is recommended that you close and re-open the source file. The error message follows: Value does not fall within expected range."

A bit of additional information I hope will be useful... This has been my first time encountering this nagging and persistent error. Right after my day job, I sat right down on my computer and started working happily away on my lil programming project. Everything was good, VS2015 Community started up like usual, but AS SOON AS I PLACED ONE BUTTON (literally, one button... dragged and dropped... didn't change anything else...) from my toolbox onto my winform, this agitating error pops up screaming nonsense. I worked for hours on my little project yesterday, debugged and tested everything before I went to bed and it all worked perfectly fine. I was happy.

I did some online research, and tried everything from repairs/reinstall to VS2015 as well as other things, like making sure all my columns in my SQLSERVER Express DB are set Visible = True. They were. I tried closing and reopening my project, VS 2015 and even restarting my desktop. This awful error is persistently following me for dragging and dropping a button on my winform, and I hope I don't lose my project. The backup save I tried to load is doing the same thing as well. I also read this was supposed to be an issue fixed with SP1 for VS? Just in case, I made double sure I'm currently up to date with fixes and downloads from Microsoft for VS.

Has anyone run into this error?! If so, please advise on how to fix and save my behavioral statistics calculator!! Thanks Overflowers!

Talk1:

post your button code from designer

Talk2:

Do you mean just the empty button code? I just created my button then double clicked to access code for it? Also... so far... and I haven't tried a whole lot yet, but the error isn't popping up anymore when I try to place my button!? To be honest, since I don't understand the nature of this error, I'm more concerned than relieved that it may come back and haunt me later?

Talk3:

please google designer code and how to access it for future reference. I t will come useful to you if you ever plan on creating controls dynamically

Talk4:

Ok, I did google it but I am a bit confused on what you are actually looking for from my code? are you looking for the code that is in my Form.Designer.cs? It is: private System.Windows.Forms.Button SearchInventButton;

Talk5:

I was looking for private void InitializeComponent() button part but nvm

Solutions1

Talk1:

I got this error in VS2015 > Update 1 and this hotfix refused to install itself.

Solutions2

I got this message after creating a TableLayoutPanel and moving some controls into it. At that point, I couldn't save the source file, the Designer file, our either from the [Design] view.

I was able to undo the last changes by selecting everything in the Designer.vb file, cutting it to the clipboard, and saving. No error message. Then I pasted everything back, saved again, and there was no error message. I checked the [Design] and the TableLayoutPanel was gone, but my controls were where they were prior to adding them to it.

After that I repeated the same steps to add the TableLayoutPanel and put the controls in it and I got no error message. It was relatively inexpensive in terms of wasted time to deal with this message. I'm not sure what would have happened if I had closed the solution according to the messages suggestion but I didn't need to find out.

Solutions3

This may not be the answer, but may lead to a solution to you or somebody else.

I came to this question because I've got the same message

"An error was encountered during code generation. The changes you have

made in the designer have not been committed to the source code..."

In my case, I created an UserControl with a Boolean property called Vertical. I added this UserControl to a Form. Everything worked, I could see the programmed behavior on the Form designer flipping Vertical property from True to False and viceversa.

Days later, I decided it would make more sense to rename the Vertical property to Show_Vertically. And few minutes later the message was there.

It turns out that whenever I added the UserControl to a Form, the designer automatically generates code inside its InitializeComponent() routine with the initial UserControl1.Vertical = True

The solution is either to change the statement inside the hidden InitializeComponent() routine or to remove and add the UserControl to the Form again.

From your comments above, I assume your error was in your SearchInventButton. I would get inside the InitilizeComponent() routine and look for any property assigned to SearchInventButton. If the button is not the problem, it may be any non-standard control that got updated like I did with mine. (You were talking about some SQL columns, did you removed some columns or changed their name? It may be that the designer assigned some format to those ones and now the designer can't find the column) But without further details, these are my 2 cents to the community.

Solutions4

Follow this steps:

1.Create a new project.

2.Copy your code and all controller to new project (step 1).

3.Exit from old project(Will not be saved) without saving.

4.Re open old project(step 3).

5.copy your all source and all controller(from step 2) to your project.

6.Save your Project.

Solutions5

I received the same error and all I did was open up the code page and delete everything on the page. I was then able to save all. Once I did that I closed and reopened Visual Studio and then reopened my project.

I hope this helps.

Solutions6

open your source code page

cut every thing

then start the project

you will receive an error

edit then past your code agine

and start your project it worked for me

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值